You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a class depends on an interface, that takes a callable argument, after changing the typehint in docblock on the interface, the class is still analysed as-if the previous typehint was present
Code snippet that reproduces the problem
Create TestInterface.php:
<?php
interface TestInterface
{
/**
* @param callable(string): void $do
*/
public function test(callable $do): void;
}
and Executor.php:
<?php
final class Executor implements TestInterface
{
public function test($do): void
{
$do('z');
}
}
Run ./vendor/bin/phpstan analyse --level 8 TestInterface.php Executor.php (there will be no errors - as expected)
Change the typehint on TestInterface (the closure got a second argument):
<?php
interface TestInterface
{
/**
* @param callable(string, string): void $do
*/
public function test(callable $do): void;
}
Run ./vendor/bin/phpstan analyse --level 8 TestInterface.php Executor.php (there will be no errors, which is now incorrect). If any change to Executor.php is made, the errors appear as expected.
Bug report
When a class depends on an interface, that takes a callable argument, after changing the typehint in docblock on the interface, the class is still analysed as-if the previous typehint was present
Code snippet that reproduces the problem
and Executor.php:
Expected output
The text was updated successfully, but these errors were encountered: