1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
This commit is contained in:
Daniil Gentili 2022-10-16 14:23:31 +02:00
parent 34000ca90d
commit 8518372cad
2 changed files with 5 additions and 23 deletions

View File

@ -124,28 +124,6 @@ class AssertionFinder
public const ASSIGNMENT_TO_RIGHT = 1; public const ASSIGNMENT_TO_RIGHT = 1;
public const ASSIGNMENT_TO_LEFT = -1; public const ASSIGNMENT_TO_LEFT = -1;
public const IS_TYPE_CHECKS = [
'is_string' => ['string', [Type::class, 'getString']],
'is_int' => ['int', [Type::class, 'getInt']],
'is_integer' => ['int', [Type::class, 'getInt']],
'is_long' => ['int', [Type::class, 'getInt']],
'is_bool' => ['bool', [Type::class, 'getBool']],
'is_resource' => ['resource', [Type::class, 'getResource']],
'is_object' => ['object', [Type::class, 'getObject']],
'array_is_list' => ['list', [Type::class, 'getList']],
'is_array' => ['array', [Type::class, 'getArray']],
'is_numeric' => ['numeric', [Type::class, 'getNumeric']],
'is_null' => ['null', [Type::class, 'getNull']],
'is_float' => ['float', [Type::class, 'getFloat']],
'is_real' => ['float', [Type::class, 'getFloat']],
'is_double' => ['float', [Type::class, 'getFloat']],
'is_scalar' => ['scalar', [Type::class, 'getScalar']],
'is_iterable' => ['iterable'],
'is_countable' => ['countable'],
'ctype_digit' => ['=numeric-string', [Type::class, 'getNumericString']],
'ctype_lower' => ['non-empty-lowercase-string', [Type::class, 'getNonEmptyLowercaseString']],
];
/** /**
* Gets all the type assertions in a conditional * Gets all the type assertions in a conditional
* *
@ -1915,6 +1893,10 @@ class AssertionFinder
return new IsType(new Atomic\TIterable()); return new IsType(new Atomic\TIterable());
case 'is_countable': case 'is_countable':
return new IsCountable(); return new IsCountable();
case 'ctype_digit':
return new IsType(new Atomic\TNumericString);
case 'ctype_lower':
return new IsType(new Atomic\TNonEmptyLowercaseString);
} }
return null; return null;

View File

@ -973,7 +973,7 @@ class MethodCallTest extends TestCase
class Datetime extends \DateTime class Datetime extends \DateTime
{ {
public static function createFromInterface(\DatetimeInterface $datetime): static public static function createFromInterface(\DateTimeInterface $datetime): static
{ {
return parent::createFromInterface($datetime); return parent::createFromInterface($datetime);
} }