Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class FillKnownParamType extends TestCase
{
$this->createMock(SomeMockedClass::class)
->method('someMethod')
->with($this->callback(fn (string $name): int => $value));
->with($this->callback(fn (string $name) => $value));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ public function refactor(Node $node): ?Class_
$hasChanged = true;
}

// the with() callback returns bool for the matcher, not the mocked method return type
if ($this->isName($node->name, 'with')) {
return null;
}

if (! $innerClosure->returnType instanceof Node) {
$returnType = $parameterTypesAndReturnType->getReturnType();
if (! $returnType instanceof Type) {
Expand Down
Loading