From ce87fc48823bff43fcc4a4a5b5b8d8def5b431c2 Mon Sep 17 00:00:00 2001 From: orklah Date: Thu, 28 Oct 2021 20:08:43 +0200 Subject: [PATCH] fix is_a when used with Stringable classes --- stubs/CoreGenericFunctions.phpstub | 2 +- tests/FunctionCallTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/stubs/CoreGenericFunctions.phpstub b/stubs/CoreGenericFunctions.phpstub index 102a7dce3..6fc4af0f9 100644 --- a/stubs/CoreGenericFunctions.phpstub +++ b/stubs/CoreGenericFunctions.phpstub @@ -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{} \ No newline at end of file diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index c50c79529..aac78de6d 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -1662,6 +1662,14 @@ class FunctionCallTest extends TestCase foo(...$arguments); ', ], + 'is_aWithStringableClass' => [ + ' $exceptionType + */ + if (\is_a(new Exception(), $exceptionType)) {} + ', + ], ]; }