Closed janedbal closed 5 months ago
@janedbal could you give more precise code when it shown the error? thank you.
The map method is called only with Closures. But it gets reported to be changed to callable
, which is more wider type than used.
$object->map(function () {});
It seems between Closure
and callable
make flip flop in case of this check removed:
then, create a method with callable
method:
final class SkipCallable
{
public function map(callable $mapper): array
{
return [];
}
public function run()
{
$this->map(function () {});
}
}
then become error:
+'09: Parameters should have "Closure" types as the only types passed to this method
Using
narrow_param: true
, method looks like this:And get wrongly reported with wider suggestion: