Skip to content

Enforce consistent splitting of multiline boolean conditions #58

Closed

Description

@coisa

The owner requested one boolean condition part per line when a condition is multiline, rather than several || operators on one line and another on the next. PR #55 exposed the gap in StandardsServiceProvider.php; its whitespace correction is separate from enforcing this policy.

Reproduced with the exact #55 d1ecaea fixture: the current ECS 13.3.8 preset returns exit 0 and leaves the mixed layout unchanged. The manually split layout also returns 0 and is stable across two fix passes. OperatorLinebreakFixer controls placement beside existing newlines; it does not split every operator. Adding bundled PEAR MultiLineConditionSniff still accepts the mixed layout and imposes another convention, so it is not an appropriate fix. This is not a demonstrated PER-specification violation.

Investigate a bounded maintained-rule solution before introducing owned token logic or new dependencies. Published Slevomat 8.31.2 exposes alwaysSplitAllConditionParts, but source inspection shows a line-count heuristic that may miss expressions with multiline calls; it is not installed or qualified as a solution in this project.

Acceptance: define and document the intended conditional-expression scope; exact negative/positive fixtures; nested expressions, comments, multiline calls and &&/|| combinations; no unintended change to single-line conditions or short-circuit semantics; check must detect violations without mutation, fix must be safe and idempotent. Qualify the effective preset and whole-project checks. Do not claim enforcement from correcting only #55's source.

Activity

  1. coisa commented on Oct 28, 2026

    @coisa
    ContributorAuthor

    Delivered by PR #63, merged at 2026-10-28 17:16:01 UTC as 2c09b15. The preset enforces the bounded multiline-condition policy, with regression fixtures for grouping, comments/literals, indentation, check without writing and idempotence. One logical operator per continuation line is a project policy extending the applicable PSR-12/PER layout requirements.

    Post-merge Quality passed on PHP 8.3, 8.4 and 8.5, including Composer validation, the aggregate check, native ECS, Twig evaluation and clean-diff verification: https://github.com/php-fast-forward/code-standards/actions/runs/40734066196 . The final PR HEAD also passed 281 tests / 2166 assertions on each PHP version.

    Review record: the CodeRabbit finding was corrected and acknowledged; its full review of the final follow-up SHA had not completed before the external merge. This comment records delivery evidence, not a retrospective review approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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