Skip to content

Add CakePHP 6.0 rector rules for void return type changes#384

Merged
LordSimal merged 1 commit into6.xfrom
rector/cakephp60-void-returns
Feb 5, 2026
Merged

Add CakePHP 6.0 rector rules for void return type changes#384
LordSimal merged 1 commit into6.xfrom
rector/cakephp60-void-returns

Conversation

@dereuromark
Copy link
Member

Summary

Add rector rules for upgrading to CakePHP 6.0, specifically handling methods that changed from returning bool to returning void.

New Rules:

  1. RemoveAssignmentFromVoidMethodRector - Removes variable assignments from method calls that now return void:

    // Before
    $result = $this->request->allowMethod('post');
    
    // After
    $this->request->allowMethod('post');
  2. Method Renames - Renames validChoice() to validateChoice() for console input classes

Affected Methods:

Class Method Change
ServerRequest allowMethod() Returns void
Configure load() Returns void
ResponseEmitter emit() Returns void
Session close() Returns void
Table deleteOrFail() Returns void
FixtureInterface insert() Returns void
FixtureInterface truncate() Returns void
ConsoleInputArgument validChoice() Renamed to validateChoice(), returns void
ConsoleInputOption validChoice() Renamed to validateChoice(), returns void

Related PRs:

@LordSimal
Copy link
Contributor

why is this on 5.x? there is a 6.x branch already present with the basic setup for 6.x and a refactored folder structure.

@dereuromark
Copy link
Member Author

dereuromark commented Feb 4, 2026

Wrong branch jep . fixed

@dereuromark dereuromark marked this pull request as draft February 4, 2026 20:31
@dereuromark dereuromark changed the base branch from 5.x to 6.x February 5, 2026 07:23
@dereuromark dereuromark added this to the 6.x milestone Feb 5, 2026
Adds RemoveAssignmentFromVoidMethodRector to strip variable assignments
from method calls that now return void in CakePHP 6.0.

Also adds validChoice() → validateChoice() rename for console input classes.

Refs cakephp/cakephp#19220
Refs cakephp/cakephp#19243
@dereuromark dereuromark force-pushed the rector/cakephp60-void-returns branch from 8d0bc89 to be2fc77 Compare February 5, 2026 07:35
@dereuromark dereuromark marked this pull request as ready for review February 5, 2026 07:46
@LordSimal LordSimal merged commit a95a6f6 into 6.x Feb 5, 2026
4 of 5 checks passed
@LordSimal LordSimal deleted the rector/cakephp60-void-returns branch February 5, 2026 08:53
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.

2 participants