1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

fix is_a when used with Stringable classes

This commit is contained in:
orklah 2021-10-28 20:08:43 +02:00
parent 526debbec4
commit ce87fc4882
2 changed files with 9 additions and 1 deletions

View File

@ -1298,6 +1298,6 @@ function get_defined_constants(bool $categorize = false): array {}
/**
* @param mixed $object_or_class
* @param class-string $class
* @return ($allow_string is false ? ($object_or_class is string ? false : bool) : bool)
* @return ($allow_string is false ? ($object_or_class is object ? bool : false) : bool)
*/
function is_a($object_or_class, string $class, $allow_string = false): bool{}

View File

@ -1662,6 +1662,14 @@ class FunctionCallTest extends TestCase
foo(...$arguments);
',
],
'is_aWithStringableClass' => [
'<?php
/**
* @psalm-var class-string<Throwable> $exceptionType
*/
if (\is_a(new Exception(), $exceptionType)) {}
',
],
];
}