Skip to content

PHPCS fails when using PHP 8 Constructor property promotion with attributes #3424

Closed
@tarlepp

Description

@tarlepp

Describe the bug
PHPCS fails when using PHP 8 Constructor property promotion with attributes.

FILE: /app/src/Entity/LogLoginFailure.php
---------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------
 75 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
 76 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
 79 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
 80 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
---------------------------------------------------------------------------------------------------------

Code sample

public function __construct(
    #[ORM\ManyToOne(
        targetEntity: User::class, // <-- line 75
        inversedBy: 'logsLoginFailure', // <-- line 76
    )]
    #[ORM\JoinColumn(
        name: 'user_id', // <-- line 79
        nullable: false, // <-- line 80
    )]
    #[Groups([
        'LogLoginFailure',
        'LogLoginFailure.user',
    ])]
    private User $user
) {
    $this->id = $this->createUuid();
    $this->timestamp = new DateTimeImmutable(timezone: new DateTimeZone('UTC'));
}

Expected behavior
No errors

Versions (please complete the following information):

  • PHP: 8.0.10
  • PHPCS: 3.6.0
  • Standard: PSR2, PSR12

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