Skip to content

[13.x] Fix ReflectsClosures::firstClosureParameterTypes() returning wrong parameter's type - #60976

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
lucasmichot:fix/reflects-closures-first-parameter-type
Aug 3, 2026
Merged

[13.x] Fix ReflectsClosures::firstClosureParameterTypes() returning wrong parameter's type#60976
taylorotwell merged 1 commit into
laravel:13.xfrom
lucasmichot:fix/reflects-closures-first-parameter-type

Conversation

@lucasmichot

@lucasmichot lucasmichot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

firstClosureParameterTypes() filtered out empty/null entries and reindexed before reading index 0. If the first closure parameter had no type hint but a later one did, the later parameter's types silently shifted into index 0 instead of throwing the expected RuntimeException.

Also fixes the proxy() helper, which rebuilt its reflector on every call instead of caching it like lazy() does.

@lucasmichot lucasmichot changed the title Fix ReflectsClosures::firstClosureParameterTypes() returning wrong parameter's type [13.x] Fix ReflectsClosures::firstClosureParameterTypes() returning wrong parameter's type Aug 2, 2026
@taylorotwell

Copy link
Copy Markdown
Member

Has conflicts.

@taylorotwell
taylorotwell marked this pull request as draft August 2, 2026 20:40
…rameter's type

filter()->values() reindexed the array before grabbing index 0, so an
untyped first parameter got silently dropped and a later typed
parameter took its place instead of the expected RuntimeException.

Also fixes proxy() helper not caching its static reflector instance.
@lucasmichot
lucasmichot force-pushed the fix/reflects-closures-first-parameter-type branch from 47f5ce4 to c6c0bce Compare August 3, 2026 04:58
@lucasmichot

Copy link
Copy Markdown
Contributor Author

Has conflicts.

Fixed

@lucasmichot
lucasmichot marked this pull request as ready for review August 3, 2026 12:33
@taylorotwell
taylorotwell merged commit 71f8d2b into laravel:13.x Aug 3, 2026
53 checks passed
@lucasmichot
lucasmichot deleted the fix/reflects-closures-first-parameter-type branch August 3, 2026 18:08
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