Repository navigation
PHP85-138 Accept array callables to non-public methods in getBehavior() again - #52
Merged
Merged
Conversation
6.0.0 typed Builder::getBehavior()'s first parameter as string|callable. defaultBehavior() and Manager::invoke() pass their strategy through that parameter, so a [$this, 'protectedMethod'] array, which is not callable from the Builder's scope, is rejected by PHP before reaching the branch that binds it into a closure. Swivel 4 accepted it, swivel-cake's README documents it, and admin, public and service all use it. Widen the parameter to string|callable|array so the existing bindTo() branch handles the array as before. Two regression tests fail on 6.0.1 with "Argument #1 ($slug) must be of type callable|string, array given". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lucasesansim
approved these changes
Oct 28, 2026
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.
Accept array callables to non-public methods in
getBehavior()again6.0.0 typed
Builder::getBehavior()'s first parameter asstring|callable.defaultBehavior()andManager::invoke()pass their strategy through that parameter, so a[$this, 'protectedMethod']array is rejected by PHP before it reaches the branch that binds it into a closure (callableis scope-sensitive: a protected method is not callable from the Builder's scope). Swivel 4 accepted it, this repo's README documents it (defaultBehavior([$this, 'renderOldView'])with a protectedrenderOldView), and admin, public and service all use it.Change
Builder::getBehavior()andBuilderInterface::getBehavior(): first parameter isstring|callable|array, so the existingbindTo()branch handles the array as in 4.x. No other behavior change.BuilderTest: two regression tests (getBehavior()with a protected array callable as the strategy;defaultBehavior()with a protected target throughexecute()). Both fail on 6.0.1 and pass here. Suite: 173 tests, PSR-2 clean.Who is affected on 6.0.1
TrainingsController::membershipFees()is private and is the default ofZinRefactor.Benefit.ReplaceRole; it throws whenever that flag is off for the bucket.Suggested tag:
v6.0.2. swivel-cake already allows it (^6.0.1); admin and public pick it up withcomposer update zumba/swivel.🤖 Generated with Claude Code