Skip to content

[CodeQuality] Skip mocked method return type on with() callback closure in TypeWillReturnCallableArrowFunctionRector - #846

Merged
TomasVotruba merged 1 commit into
mainfrom
callback-closure-no-mocked-return-type
Dec 2, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
callback-closure-no-mocked-return-type

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The closure inside ->with($this->callback(...)) got the mocked method return type. That closure is the argument matcher, it must return bool, not what the mocked method returns:

-->with($this->callback(fn ($name) => $value));
+->with($this->callback(fn (string $name): int => $value));

The param type is still filled, the return type is now left out for the with() callback.

…re in TypeWillReturnCallableArrowFunctionRector
@TomasVotruba
TomasVotruba force-pushed the callback-closure-no-mocked-return-type branch from 312b2f0 to 495dad9 Compare December 2, 2026 11:02
@TomasVotruba
TomasVotruba merged commit e422112 into main Dec 2, 2026
15 checks passed
@TomasVotruba
TomasVotruba deleted the callback-closure-no-mocked-return-type branch December 2, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant