Skip to content

Commit

Permalink
Deprecate TypeVisitor::int() in favor of TypeVisitor::intRange()
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Apr 12, 2024
1 parent 5d2ff96 commit f0ef59d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions TypeReflection/TypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit f0ef59d

Please sign in to comment.