On Sat, Jul 20, 2024, at 7:21 PM, Rik van der Heijden wrote:
> Hi all,
>
> I'm currently working on implementing PER Coding Style 2.0 for PHP 
> CodeSniffer, and I'm facing some ambiguity in the specification.
>
> There is a section on method chaining. But what if the first called 
> method is a static call to a class. It is not outlined if the static 
> call should be indented or not.
>
> Like this:
>
> MyClass::getInstance()
>     ->foo()
>     ->bar();
>
> Or this:
>
> MyClass
>     ::getInstance()
>     ->foo()
>     ->bar();
>
> This is ambigious in the specification currently since it does not 
> outline whether a static call is considered 'part of the chain' or not.
>
> Also, hello, my name is Rik and I'm new here. I'm in the PHP 'world' 
> for +- 20y. I might have more questions/suggestions as I'm plowing 
> through it.
>
> Kind regards,
>
> Rik

Welcome!

I would also say that :: is not part of the call chain, and should be on the 
same line as the class.

Please open an Issue on the PER-CS repository 
(https://github.com/php-fig/per-coding-style).  We'll see if we can get this 
clarified in the 2.1 release.  (We still have to discuss how to handle the new 
syntax in 8.4, but haven't gotten there yet.)

--Larry Garfield

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/46b6b87a-7d3e-44ca-bbee-30b2e73e9550%40app.fastmail.com.

Reply via email to