Repository navigation
Add more CakePHP 6 upgrade rules - #419
Merged
Merged
Conversation
- 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
force-pushed
the
feature/6x-container-controller-rules
branch
from
November 29, 2026 11:46
72fea03 to
584f27f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds rules to the
cakephp60set for 6.0 changes it didn't cover yet, and fixes two rules that produced incorrect code.New rules
league/containercakephp#19559):Cake\Core\Container,Cake\Core\ContainerInterfaceandCake\Core\ServiceProviderare renamed to theirCake\Container\*equivalents. AllLeague\Container\*classes are renamed to the matchingCake\Container\*class.DefinitionContainerInterface(both League and Cake) becomesCake\Container\ContainerInterface.beforeFilter(),beforeRender(),afterFilter()andbeforeRedirect()get a: voidreturn type.Table::deleteManyOrFail()(6.0: Change Table::deleteManyOrFail() return type to void cakephp#19433): it now returnsvoid, so assignments of its result are removed.beforeExecute()andafterExecute()overrides getConsoleIoInterfaceinstead ofConsoleIofor$io.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$argsand$iofrom every method in a command. 6.x still passes both tobeforeExecute()andafterExecute(), so removing them made the overrides incompatible with the parent signature. The rule now skips these two methods.Notes
voidto 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
testApply60covers each new rule.ReplaceCommandArgsIoWithPropertiesRectorleaves the command hooks alone.🤖 Generated with Claude Code