|
251 | 251 | foreach ($subjects as $name => $subject) { |
252 | 252 | $r["$name class"] = $view($subject); |
253 | 253 | $r["$name instanceof"] = [$subject instanceof \PHPStan\Type\Type, $subject instanceof $intClass, $subject instanceof \PHPStan\Type\ConstantScalarType, $subject instanceof \PHPStan\Type\CompoundType]; |
| 254 | + if ($subject instanceof $rangeClass) { |
| 255 | + // the private helper isSubTypeOf() hands a union to |
| 256 | + $unions = [ |
| 257 | + 'consts0-10' => new \PHPStan\Type\UnionType(array_map(static fn (int $i) => new $constIntClass($i), range(0, 10))), |
| 258 | + 'consts3-4|string' => new \PHPStan\Type\UnionType([new $constIntClass(3), new $constIntClass(4), new \PHPStan\Type\StringType()]), |
| 259 | + 'range0-5|string' => new \PHPStan\Type\UnionType([$rangeClass::fromInterval(0, 5), new \PHPStan\Type\StringType()]), |
| 260 | + ]; |
| 261 | + foreach ($unions as $unionName => $union) { |
| 262 | + $r["$name isSubTypeOfUnionWithReason $unionName"] = $view((fn () => $this->isSubTypeOfUnionWithReason($union))->call($subject)); |
| 263 | + } |
| 264 | + } |
254 | 265 | foreach (['typeOnly' => \PHPStan\Type\VerbosityLevel::typeOnly(), 'value' => \PHPStan\Type\VerbosityLevel::value(), 'precise' => \PHPStan\Type\VerbosityLevel::precise(), 'cache' => \PHPStan\Type\VerbosityLevel::cache()] as $levelName => $level) { |
255 | 266 | $r["$name describe $levelName"] = $subject->describe($level); |
256 | 267 | } |
@@ -7717,6 +7728,21 @@ public function getResolvedPhpDoc(): ?\PHPStan\PhpDoc\ResolvedPhpDocBlock { retu |
7717 | 7728 | foreach ([0, 1, 5, 200, 1000, PHP_INT_MAX] as $value) { |
7718 | 7729 | $r["allBitsMask $value"] = $catching(static fn () => $staticPrivate('allBitsMask', $value)); |
7719 | 7730 | } |
| 7731 | + foreach ($operands as $name => $operand) { |
| 7732 | + $r["getIntegerBounds $name"] = $catching(static fn () => $private('getIntegerBounds', $operand)); |
| 7733 | + } |
| 7734 | + foreach ($integerOperands as $name => $operand) { |
| 7735 | + $r["getIntegerBounds $name"] = $catching(static fn () => $private('getIntegerBounds', $operand)); |
| 7736 | + } |
| 7737 | + foreach ([[null, 5], [-7, 3], [PHP_INT_MIN, 1], [PHP_INT_MIN + 1, 1], [0, 0], [3, null], [-2, -9]] as [$divisorMin, $divisorMax]) { |
| 7738 | + $r['getMaxModuloMagnitude ' . var_export($divisorMin, true) . ' ' . var_export($divisorMax, true)] = $catching(static fn () => $staticPrivate('getMaxModuloMagnitude', $divisorMin, $divisorMax)); |
| 7739 | + } |
| 7740 | + foreach ([[1, 1], [1, 62], [1, 63], [PHP_INT_MAX, 1], [-1, 63], [-5, 2], [5, -1], [5, 64]] as [$value, $shift]) { |
| 7741 | + $r["shiftLeftOverflows $value $shift"] = $catching(static fn () => $staticPrivate('shiftLeftOverflows', $value, $shift)); |
| 7742 | + } |
| 7743 | + foreach ([1.5, -1.5, INF, -INF, NAN, 1e30, -1e30, (float) PHP_INT_MAX, (float) PHP_INT_MIN, 0.0] as $i => $value) { |
| 7744 | + $r["toIntBound $i"] = $catching(static fn () => $staticPrivate('toIntBound', $value)); |
| 7745 | + } |
7720 | 7746 | foreach ([null, true, 1, 1.5, 'x'] as $i => $value) { |
7721 | 7747 | $r["getTypeFromValue $i"] = $catching(static fn () => $private('getTypeFromValue', $value)); |
7722 | 7748 | } |
|
0 commit comments