Skip to content

Add more CakePHP 6 upgrade rules - #419

Merged
LordSimal merged 1 commit into
6.xfrom
feature/6x-container-controller-rules
Nov 29, 2026
Merged

LordSimal merged 1 commit into
6.xfrom
feature/6x-container-controller-rules

Conversation

@LordSimal

Copy link
Copy Markdown
Member

Adds rules to the cakephp60 set for 6.0 changes it didn't cover yet, and fixes two rules that produced incorrect code.

New rules

Fixes

  • Entity::$_fields (6.0 - Entity props with hooks cakephp#19381): the general underscore-removal rule renamed this property to $fields. In 6.x it is $dynamicFields, so it now has its own rename.
  • ReplaceCommandArgsIoWithPropertiesRector (6.x: command refactor cakephp#18983): the rule removed $args and $io from every method in a command. 6.x still passes both to beforeExecute() and afterExecute(), so removing them made the overrides incompatible with the parent signature. The rule now skips these two methods.

Notes

  • Renamed classes are written fully qualified, as with the existing Diactoros renames.
  • Adding void to the controller callbacks assumes the 5.x deprecation of returning values from callbacks has been fixed. An override that still returns a response will break.

Tests

  • The test app for testApply60 covers each new rule.
  • A new fixture checks that ReplaceCommandArgsIoWithPropertiesRector leaves the command hooks alone.
  • The full suite passes (77 tests), and phpcs is clean.

🤖 Generated with Claude Code

- Rename Cake\Core container classes and league/container classes to
  Cake\Container (cakephp/cakephp#19559)
- Add void return type to Controller callbacks (cakephp/cakephp#18660)
- Remove assignments from Table::deleteManyOrFail() (cakephp/cakephp#19433)
- Use ConsoleIoInterface in beforeExecute()/afterExecute() (cakephp/cakephp#18391)
- Rename Entity::$_fields to $dynamicFields (cakephp/cakephp#19381)
- Don't strip $args/$io from command event hooks (cakephp/cakephp#18983)
@LordSimal
LordSimal force-pushed the feature/6x-container-controller-rules branch from 72fea03 to 584f27f Compare November 29, 2026 11:46
@LordSimal
LordSimal merged commit c80bc25 into 6.x Nov 29, 2026
5 checks passed
@LordSimal
LordSimal deleted the feature/6x-container-controller-rules branch November 29, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant