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
Array key which is a value of type int returned from static method called on string prechecked by is_a is wrongly treated as int|string in PHPStan 1.4.1 (there was no error in PHPStan 1.3.1):
classFoo {
publicstaticfunctiongetCode(): int {
return1;
}
}
if (is_a($fooClass, Foo::class, true)) {
$this->someMap[$fooClass::getCode()] = true;
}
Property Bar::$someMap (array<int, bool>) does not accept array<int|string, bool>.
The issue might be related to #6403, but it looks like a little bit different.
Bug report
Array key which is a value of type
int
returned from static method called on string prechecked byis_a
is wrongly treated asint|string
in PHPStan 1.4.1 (there was no error in PHPStan 1.3.1):The issue might be related to #6403, but it looks like a little bit different.
Code snippet that reproduces the problem
https://phpstan.org/r/f2efd61c-09c3-4f12-8694-a353dbb4c245
Expected output
No error should be reported.
The text was updated successfully, but these errors were encountered: