diff --git a/src/Psalm/Type/Atomic.php b/src/Psalm/Type/Atomic.php index 657657bae..7e5a258ea 100644 --- a/src/Psalm/Type/Atomic.php +++ b/src/Psalm/Type/Atomic.php @@ -45,7 +45,6 @@ use Psalm\Type\Atomic\TLiteralString; use Psalm\Type\Atomic\TLowercaseString; use Psalm\Type\Atomic\TMixed; use Psalm\Type\Atomic\TNamedObject; -use Psalm\Type\Atomic\TNegativeInt; use Psalm\Type\Atomic\TNever; use Psalm\Type\Atomic\TNonEmptyArray; use Psalm\Type\Atomic\TNonEmptyList; @@ -55,8 +54,6 @@ use Psalm\Type\Atomic\TNonEmptyNonspecificLiteralString; use Psalm\Type\Atomic\TNonEmptyScalar; use Psalm\Type\Atomic\TNonEmptyString; use Psalm\Type\Atomic\TNonFalsyString; -use Psalm\Type\Atomic\TNonNegativeInt; -use Psalm\Type\Atomic\TNonPositiveInt; use Psalm\Type\Atomic\TNonspecificLiteralInt; use Psalm\Type\Atomic\TNonspecificLiteralString; use Psalm\Type\Atomic\TNull; @@ -234,13 +231,13 @@ abstract class Atomic implements TypeNode return new TPositiveInt(); case 'non-positive-int': - return new TNonPositiveInt(); + return new TIntRange(null, -1); case 'negative-int': - return new TNegativeInt(); + return new TIntRange(null, -1); case 'non-negative-int': - return new TNonNegativeInt(); + return new TPositiveInt(); case 'numeric': return $php_version !== null ? new TNamedObject($value) : new TNumeric(); @@ -732,18 +729,6 @@ abstract class Atomic implements TypeNode return true; } - if ($this instanceof TNonPositiveInt) { - return true; - } - - if ($this instanceof TNegativeInt) { - return true; - } - - if ($this instanceof TNonNegativeInt) { - return true; - } - if ($this instanceof TLiteralClassString) { return true; } diff --git a/src/Psalm/Type/Atomic/TNegativeInt .php b/src/Psalm/Type/Atomic/TNegativeInt .php deleted file mode 100644 index 1325492cd..000000000 --- a/src/Psalm/Type/Atomic/TNegativeInt .php +++ /dev/null @@ -1,41 +0,0 @@ - $aliased_classes - * - */ - public function toNamespacedString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - bool $use_phpdoc_format - ): string { - return $use_phpdoc_format ? 'int' : 'negative-int'; - } -} diff --git a/src/Psalm/Type/Atomic/TNonNegativeInt.php b/src/Psalm/Type/Atomic/TNonNegativeInt.php deleted file mode 100644 index 10c16d638..000000000 --- a/src/Psalm/Type/Atomic/TNonNegativeInt.php +++ /dev/null @@ -1,41 +0,0 @@ - 0) - * @deprecated will be removed in Psalm 5 - */ -class TNonNegativeInt extends TInt -{ - public function getId(bool $nested = false): string - { - return 'non-negative-int'; - } - - public function __toString(): string - { - return 'non-negative-int'; - } - - /** - * @return false - */ - public function canBeFullyExpressedInPhp(int $php_major_version, int $php_minor_version): bool - { - return false; - } - - /** - * @param array $aliased_classes - * - */ - public function toNamespacedString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - bool $use_phpdoc_format - ): string { - return $use_phpdoc_format ? 'int' : 'non-negative-int'; - } -} diff --git a/src/Psalm/Type/Atomic/TNonPositiveInt.php b/src/Psalm/Type/Atomic/TNonPositiveInt.php deleted file mode 100644 index dbc66be77..000000000 --- a/src/Psalm/Type/Atomic/TNonPositiveInt.php +++ /dev/null @@ -1,41 +0,0 @@ - $aliased_classes - * - */ - public function toNamespacedString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - bool $use_phpdoc_format - ): string { - return $use_phpdoc_format ? 'int' : 'non-positive-int'; - } -}