Skip to content

Commit

Permalink
Use string & numeric-string for numeric-string
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Sep 13, 2023
1 parent f1a2ab6 commit b1dd3a5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Validation/TypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use PHPStan\Type\UnionType;

final class TypeResolver
Expand Down Expand Up @@ -153,13 +154,19 @@ private function resolveType(Rule $rule): ?Type\Type
// We can't use numeric ranges here because laravel doesn't cast it to an integer or float
"Digits", "DigitsBetween", "Decimal", "MaxDigits", "MinDigits", "MultipleOf",
"Numeric" => Type\TypeCombinator::union(
new AccessoryNumericStringType(),
new IntersectionType([
new StringType(),
new AccessoryNumericStringType(),
]),
new Type\IntegerType(),
new Type\FloatType()
),

"Integer" => Type\TypeCombinator::union(
new AccessoryNumericStringType(),
new IntersectionType([
new StringType(),
new AccessoryNumericStringType(),
]),
new Type\IntegerType()
),

Expand Down

0 comments on commit b1dd3a5

Please sign in to comment.