diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index 5f4bcdf0f27..3396deae0e1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -1871,9 +1871,9 @@ private static function getIsAssertion(string $function_name): ?Assertion return new IsType(new Atomic\TString()); case 'is_int': case 'is_integer': + case 'is_long': return new IsType(new Atomic\TInt()); case 'is_float': - case 'is_long': case 'is_double': case 'is_real': return new IsType(new Atomic\TFloat()); diff --git a/tests/TypeReconciliation/TypeTest.php b/tests/TypeReconciliation/TypeTest.php index 2573bc7549f..f287d66d264 100644 --- a/tests/TypeReconciliation/TypeTest.php +++ b/tests/TypeReconciliation/TypeTest.php @@ -1239,6 +1239,32 @@ function foo(array $arr) : void { strlen($s); }', ], + 'testIsIntAndAliasesTypeNarrowing' => [ + 'code' => ' [ + '$b===' => 'int', + '$c===' => 'int', + '$d===' => 'int', + ], + ], 'narrowWithCountToAllowNonTupleKeyedArray' => [ 'code' => '