Skip to content

PEAR method chaining wrong indentation #745

Closed
@cweiske

Description

@cweiske

The PEAR coding standard says in https://pear.php.net/manual/en/standards.funcalls.php

Using fluent application programming interfaces often leads to many concatenated function calls. Those calls may be split onto several lines. When doing this, all subsequent lines are indented by 4 spaces and begin with the "->" arrow.

<?php
$someObject->someFunction("some", "parameter")
    ->someOtherFunc(23, 42)
    ->andAThirdFunction();
?> 

On my emacs 27.1 with php-mode 20230423.1446 the second method call arrow is directly below the previous arrow (wrong):

        $pages = $dbOld->createQueryBuilder()
                       ->select('*')

Setting php-mode-lineup-cascaded-calls to nil aligns the -> with the = (wrong):

        $pages = $dbOld->createQueryBuilder()
               ->select('*')

When enabling the pear coding style, it should be indented 4 spaces:

        $pages = $dbOld->createQueryBuilder()
            ->select('*')

(Related to #237, which was the same problem with PSR2)

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