Skip to content

SlevomatCodingStandard.Classes.ClassMemberSpacing not working well with PHP 8.0 attributes #1155

@radek-bruha

Description

@radek-bruha

Hello, there is a problem that ClassMemberSpacing sniff not allowing PHP 8.0 attributes between method and it's comment.

slevomat/coding-standard   dev-master 47cf967 
squizlabs/php_codesniffer  dev-master 285de0d 
  /**
   * @var DateTimeImmutable
   */
  private DateTimeImmutable $date;

  /**
   * @return DateTimeImmutable
   */
  #[GraphQL\Field] // This is problem :(
  public function getDate(): DateTimeImmutable
  {
      return $this->date;
  }
----------------------------------------------------------------------
 36 | ERROR | [x] Expected 1 blank line between class members, found 5.
    |       |     (SlevomatCodingStandard.Classes.ClassMemberSpacing.IncorrectCountOfBlankLinesBetweenMembers)
----------------------------------------------------------------------

Without #[GraphQL\Field] line everything works well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions