Skip to content

Wrapping of static method calls #2432

@hackel

Description

@hackel

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions