diff --git a/Visitor/RecursiveTypeReplacer.php b/Visitor/RecursiveTypeReplacer.php index cc128bf..6885953 100644 --- a/Visitor/RecursiveTypeReplacer.php +++ b/Visitor/RecursiveTypeReplacer.php @@ -19,6 +19,18 @@ */ abstract class RecursiveTypeReplacer extends DefaultTypeVisitor { + public function int(Type $type, Type $minType, Type $maxType): mixed + { + $newMinType = $minType->accept($this); + $newMaxType = $maxType->accept($this); + + if ($newMinType === $minType && $newMaxType === $maxType) { + return $type; + } + + return types::intRange($newMinType, $newMaxType); + } + public function intMask(Type $type, Type $ofType): mixed { $newOfType = $ofType->accept($this); @@ -30,6 +42,18 @@ public function intMask(Type $type, Type $ofType): mixed return types::intMaskOf($newOfType); } + public function float(Type $type, Type $minType, Type $maxType): mixed + { + $newMinType = $minType->accept($this); + $newMaxType = $maxType->accept($this); + + if ($newMinType === $minType && $newMaxType === $maxType) { + return $type; + } + + return types::floatRange($newMinType, $newMaxType); + } + public function classString(Type $type, Type $classType): mixed { $newClassType = $classType->accept($this);