From f0ef59d487ed197ca95358e07ab46bd5c15405ce Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Tue, 9 Apr 2024 23:30:22 +0300 Subject: [PATCH] Deprecate `TypeVisitor::int()` in favor of `TypeVisitor::intRange()` --- TypeReflection/TypeConverter.php | 8 ++++++-- composer.json | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/TypeReflection/TypeConverter.php b/TypeReflection/TypeConverter.php index a84e8b9..d17c498 100644 --- a/TypeReflection/TypeConverter.php +++ b/TypeReflection/TypeConverter.php @@ -22,9 +22,13 @@ public function string(Type $self): mixed return NamedTypeReflection::string(); } - public function int(Type $self): mixed + public function intRange(Type $self, ?int $min, ?int $max): mixed { - return NamedTypeReflection::int(); + if ($min === null && $max === null) { + return NamedTypeReflection::int(); + } + + throw new NonConvertableType($self); } public function float(Type $self): mixed diff --git a/composer.json b/composer.json index da76a53..3e6a044 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ "phpstan/phpdoc-parser": "^1.0", "psr/simple-cache": "^3.0", "symfony/deprecation-contracts": "^3.4", - "typhoon/type": "^0.3", - "typhoon/type-stringifier": "^0.3" + "typhoon/type": "^0.3.3", + "typhoon/type-stringifier": "^0.3.3" }, "autoload": { "psr-4": {