8000 [TypeInfo] Add `IntRangeType` to hold specific type details for `int` builtin types by DerManoMann · Pull Request #59676 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TypeInfo] Add IntRangeType to hold specific type details for int builtin types #59676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Prev Previous commit
Add BC comments and missing else case
  • Loading branch information
DerManoMann committed Feb 23, 2025
commit c6e6eadddfc3804bfbf2cd4447639875655a1237
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,13 @@ public static function pseudoTypesProvider(): iterable
yield ['arrayKey', Type::union(Type::int(), Type::string())];
yield ['double', Type::float()];

// BC layer for symfony/type-info < 7.3
if (method_exists(Type::class, 'intRange')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (method_exists(Type::class, 'intRange')) {
// BC layer for symfony/type-info < 7.3
if (method_exists(Type::class, 'intRange')) {

yield ['positiveInt', Type::intRange(1)];
8000 yield ['negativeInt', Type::intRange(\PHP_INT_MIN, -1)];
} else {
yield ['positiveInt', Type::int()];
yield ['negativeInt', Type::int()];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It misses the else

}

Expand Down Expand Up @@ -1004,6 +1008,7 @@ public function testExtractorIntRangeType(string $property, ?Type $type)
*/
public static function intRangeTypeProvider(): iterable
{
// BC layer for symfony/type-info < 7.3
if (method_exists(Type::class, 'intRange')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6661
if (method_exists(Type::class, 'intRange')) {
// BC layer for symfony/type-info < 7.3
if (method_exists(Type::class, 'intRange')) {

yield ['a', Type::intRange(0, 100)];
yield ['b', Type::nullable(Type::intRange(\PHP_INT_MIN, 100))];
Expand Down
Loading
0