Skip to content

PSR2 forcing exact indent for function call opening statements #1793

Closed
@lcobucci

Description

@lcobucci

When running v3.1.1 and using PSR-2 as standard, this code doesn't show any error:

return (new Builder())->setA(1)
                      ->setB(2)
                      ->setC(
                          new Test(3)
                      );

On 3.2 (because of the changes in 9286141, I believe) PHPCS is not handling line alignments the way it used to do.

Since PSR-2 doesn't define rules for line alignments I believe that PHPCS shouldn't enforce anything, so maybe this is a BC-break.

v3.1.1:

$ phpcs aa.php 
. 1 / 1 (100%)


Time: 135ms; Memory: 6Mb

v3.2.0:

$ phpcs aa.php 
E 1 / 1 (100%)



FILE: aa.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------
 4 | ERROR | [x] Opening statement of multi-line function call not indented correctly; expected 20 spaces but found 22
 5 | ERROR | [x] Multi-line function call not indented correctly; expected 24 spaces but found 26
 6 | ERROR | [x] Multi-line function call not indented correctly; expected 20 spaces but found 22
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------

Time: 85ms; Memory: 6Mb

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