mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fixes #9384
This commit is contained in:
parent
e96a929451
commit
f026226aa3
@ -1871,9 +1871,9 @@ class AssertionFinder
|
||||
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());
|
||||
|
@ -1239,6 +1239,32 @@ class TypeTest extends TestCase
|
||||
strlen($s);
|
||||
}',
|
||||
],
|
||||
'testIsIntAndAliasesTypeNarrowing' => [
|
||||
'code' => '<?php
|
||||
/** @var mixed $a */
|
||||
$a;
|
||||
/** @var never $b */
|
||||
$b;
|
||||
/** @var never $c */
|
||||
$c;
|
||||
/** @var never $d */
|
||||
$d;
|
||||
if (is_int($a)) {
|
||||
$b = $a;
|
||||
}
|
||||
if (is_integer($a)) {
|
||||
$c = $a;
|
||||
}
|
||||
if (is_long($a)) {
|
||||
$d = $a;
|
||||
}
|
||||
',
|
||||
'assertions' => [
|
||||
'$b===' => 'int',
|
||||
'$c===' => 'int',
|
||||
'$d===' => 'int',
|
||||
],
|
||||
],
|
||||
'narrowWithCountToAllowNonTupleKeyedArray' => [
|
||||
'code' => '<?php
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user