plugin-php icon indicating copy to clipboard operation
plugin-php copied to clipboard

Wrapping of static method calls

Open hackel opened this issue 7 months ago • 0 comments

The plugin is currently wrapping variable static method calls before the double-colon ::. This seems wrong to me, but at least warrants some further discussion. It doesn't appear to be mentioned in PER-CS 2.0 at all, so it's not technically wrong. We do not do this wrapping direct static method calls from a class name, only from a variable.

@prettier/plugin-php v0.22.4 Playground link

Input:

<?php

$thisIsAReallyLongVariableNameUsedToTriggerTheBehaviour::staticMethod()
    ->anotherMethod();

Output:

<?php

$thisIsAReallyLongVariableNameUsedToTriggerTheBehaviour
    ::staticMethod()
    ->anotherMethod();

hackel avatar Jul 03 '25 17:07 hackel