Skip to content

Allow semicolons for chained method calls to go on a separate line #5

@colinodell

Description

@colinodell

Code like this should be considered valid:

$obj->setFoo('foo')
    ->setBar('bar')
    ->setBaz('bar')
;

Where the semicolon is allowed on the next line with the same indentation that $obj has. Currently, our coding standard forces this semicolon onto the last method call:

 $obj->setFoo('foo')
     ->setBar('bar')
+    ->setBaz('bar');
-    ->setBaz('bar')
-;

This would require something like PHP-CS-Fixer/PHP-CS-Fixer#3679 to be merged, or us to write a custom sniff.

See also PHP-CS-Fixer/PHP-CS-Fixer#2723

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions