File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
src/Psalm/Internal/Analyzer/Statements/Expression Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -1871,9 +1871,9 @@ private static function getIsAssertion(string $function_name): ?Assertion
18711871 return new IsType (new Atomic \TString ());
18721872 case 'is_int ' :
18731873 case 'is_integer ' :
1874+ case 'is_long ' :
18741875 return new IsType (new Atomic \TInt ());
18751876 case 'is_float ' :
1876- case 'is_long ' :
18771877 case 'is_double ' :
18781878 case 'is_real ' :
18791879 return new IsType (new Atomic \TFloat ());
Original file line number Diff line number Diff line change @@ -1239,6 +1239,32 @@ function foo(array $arr) : void {
12391239 strlen($s);
12401240 } ' ,
12411241 ],
1242+ 'testIsIntAndAliasesTypeNarrowing ' => [
1243+ 'code ' => '<?php
1244+ /** @var mixed $a */
1245+ $a;
1246+ /** @var never $b */
1247+ $b;
1248+ /** @var never $c */
1249+ $c;
1250+ /** @var never $d */
1251+ $d;
1252+ if (is_int($a)) {
1253+ $b = $a;
1254+ }
1255+ if (is_integer($a)) {
1256+ $c = $a;
1257+ }
1258+ if (is_long($a)) {
1259+ $d = $a;
1260+ }
1261+ ' ,
1262+ 'assertions ' => [
1263+ '$b=== ' => 'int ' ,
1264+ '$c=== ' => 'int ' ,
1265+ '$d=== ' => 'int ' ,
1266+ ],
1267+ ],
12421268 'narrowWithCountToAllowNonTupleKeyedArray ' => [
12431269 'code ' => '<?php
12441270 /**
You can’t perform that action at this time.
0 commit comments