Skip to content

PSR12/Squiz/PEAR standards all error on promoted properties with docblocks #3342

@arslanov-artur

Description

@arslanov-artur

Describe the bug
Promoted properties without PHPDoc was fixed in 3.6.0, but with PHPDoc it still gives an error (in 3.6.0):
Multi-line function declaration not indented correctly; expected 8 spaces but found 0

Code sample

use Symfony\Component\Validator\Constraints as Assert; final class Command { public function __construct( /**  * @var string  * @Assert\NotBlank()  */ public string $username ) { } }

Custom ruleset

<?xml version="1.0" encoding="UTF-8"?> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> <arg name="basepath" value="."/> <arg name="cache" value=".phpcs-cache"/> <arg name="colors"/> <arg name="extensions" value="php"/> <rule ref="PSR12"/> <file>src/</file> </ruleset>

To reproduce
You can try to build this project:
https://github.com/Arslanoov/messenger-api

  1. git clone https://github.com/Arslanoov/messenger-api.git
  2. make init
  3. make install-deps
  4. make cs

Or create a class with promoted properties and PHPDoc

ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 0 

Expected behavior
No error on promoted properties with PHPDoc

Versions (please complete the following information):

  • OS: Ubuntu 20.04
  • PHP: 8.0
  • PHPCS: 3.6.0
  • Standard: 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