diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index 9fb041048..09e411a90 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -124,28 +124,6 @@ class AssertionFinder public const ASSIGNMENT_TO_RIGHT = 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 * @@ -1915,6 +1893,10 @@ class AssertionFinder return new IsType(new Atomic\TIterable()); case 'is_countable': return new IsCountable(); + case 'ctype_digit': + return new IsType(new Atomic\TNumericString); + case 'ctype_lower': + return new IsType(new Atomic\TNonEmptyLowercaseString); } return null; diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index cf151c816..8e2eaa327 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -973,7 +973,7 @@ class MethodCallTest extends TestCase class Datetime extends \DateTime { - public static function createFromInterface(\DatetimeInterface $datetime): static + public static function createFromInterface(\DateTimeInterface $datetime): static { return parent::createFromInterface($datetime); }