Review main Merged

93890[TASK] Upgrade php-cs-fixer ruleset to @PER-CS3x0

Benni Mack CR +2 V +2 Nightmare +2429 −2446 updated 05/06/26, 08:52

Commit message

Switches the base ruleset from @PER-CS1x0 to @PER-CS3x0, which
transitively includes @PER-CS2x0 and @PER-CS3x0 rules. Rules that
were previously declared explicitly but are now covered by the
upgraded set are removed:

- array_indentation
- array_syntax
- concat_space
- function_declaration
- method_argument_space
- single_line_empty_body
- single_space_around_construct
- declare_equal_normalize (already covered by @PSR12 with default space: none)
- return_type_declaration (already covered by @PSR12 with default space_before: none)

Two explicit overrides remain to deviate from PER-CS3x0 defaults:

- cast_spaces: 'none' instead of 'single'
- nullable_type_declaration: 'question_mark' (?Type) instead of
  'union' (Type|null)

Note: php-cs-fixer's @PER-CS3x0 ruleset is a partial implementation.
Known gaps not yet covered by fixers:

PER-CS 2.0 (https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247):
- Arrow function spacing (fn/=> surrounded by spaces)
- Multiline arrow function => placement on new lines
- Method chaining multiline enforcement
- PascalCase validation for enum cases/constants

PER-CS 3.0 (https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9191):
- Property hooks formatting (PHP 8.4, §4.9)
- set-visibility modifier order, e.g. private(set) (§4.6)
- Callable reference syntax foo(...) spacing (§4.8)
- Enum backing type spacing (§9)
- Heredoc/nowdoc same-line placement (§10)
- Attribute placement on multi-line parameters (§12)

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 358

Show 338 more files

Review log 1518

  1. Benni Mack uploaded patch set 1 04/30/26, 08:11

  2. core-ci voted on patch set 1 V +1 04/30/26, 08:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101317

  3. Oliver Klee commented on patch set 1 05/02/26, 20:50

    config.php:62

    Would it make sense to change this (in a separate change) to move closer to PER-3?
  4. Benni Mack uploaded patch set 2 V +1 05/05/26, 15:22

  5. Benni Mack updated the commit message in patch set 3 05/05/26, 15:22

  6. core-ci voted on patch set 2 V +1 05/05/26, 15:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101563

  7. core-ci voted on patch set 3 V +1 05/05/26, 15:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101564

  8. Benni Mack commented on patch set 3 05/05/26, 15:39

    This change is ready for review.

    config.php:62 Reply

    I assume we should discuss this separately (either in a change or on discuss.typo3.org)
  9. Oliver Klee commented on patch set 3 05/05/26, 16:32

    config.php:62 Reply

    Acknowledged
  10. Oliver Klee commented on patch set 3 CR -1 V +1 05/05/26, 16:36

    Looks generally very good! We need to update the minimal CS-Fixer version, though, as PER-CS3 was introduced there in version 3.86.0: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/tag/v3.86.0
  11. Garvin Hicking commented on patch set 3 05/05/26, 21:28

    what do we do with https://github.com/TYPO3/coding-standards after this is merged, I assume it should be updated too?
  12. Oliver Klee commented on patch set 3 05/05/26, 22:19

    Reply

    Yes, indeed (after this change here has been merged): https://github.com/TYPO3/coding-standards/issues/146#issuecomment-4364673451
  13. Benni Mack commented on patch set 3 05/06/26, 07:24

    Reply

    can you elaborate why you voted with a "-1" on this change? the minimal CS-Fixer is set to ^3.95
  14. Benni Mack commented on patch set 3 05/06/26, 07:24

    Reply

    Done
  15. Oliver Klee commented on patch set 3 CR +1 05/06/26, 07:40

    Reply

    My bad - I had read it as `^3.85` instead of `^3.95`. Sorry!
  16. Garvin Hicking voted on patch set 3 CR +1 V +1 05/06/26, 08:20

  17. Benni Mack voted on patch set 3 CR +2 V +2 05/06/26, 08:52

  18. Benni Mack merged patch set 4 05/06/26, 08:52