Skip to content

Commit 1d235e7

Browse files
committed
Generated types
1 parent 15b5067 commit 1d235e7

17 files changed

+24
-248
lines changed

generator/types.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
type('null', 'null'),
1414
type('false', 'false'),
1515
type('true', 'true'),
16-
type('intValue', 'int')->prop('value', 'int'),
17-
type('floatValue', 'float')->prop('value', 'float'),
16+
type('intRange', 'int')->prop('min', '?int')->prop('max', '?int'),
17+
type('floatRange', 'float')->prop('min', '?float')->prop('max', '?float'),
1818
type('stringValue', 'string')->prop('value', 'string'),
1919
type('string', 'string'),
2020
type('resource', 'resource'),
2121
// compound
22-
type('intRange', 'int')->prop('minType', 'Type<int>')->prop('maxType', 'Type<int>'),
23-
type('floatRange', 'float')->prop('minType', 'Type<float>')->prop('maxType', 'Type<float>'),
2422
type('union', 'mixed')->prop('types', 'non-empty-list<Type>'),
2523
type('intersection', 'mixed')->prop('types', 'non-empty-list<Type>'),
2624
type('diff', 'mixed')->prop('minuend', 'Type')->prop('subtrahend', 'Type'),

src/Alias/FloatMaxT.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Alias/FloatMinT.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Alias/FloatT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ enum FloatT implements Type
2020
public function accept(TypeVisitor $visitor): mixed
2121
{
2222
/** @var FloatRangeT */
23-
static $type = new FloatRangeT(FloatMinT::T, FloatMaxT::T);
23+
static $type = new FloatRangeT(null, null);
2424

2525
return $visitor->floatRange($type);
2626
}

src/Alias/IntMaxT.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Alias/IntMinT.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Alias/IntT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ enum IntT implements Type
2020
public function accept(TypeVisitor $visitor): mixed
2121
{
2222
/** @var IntRangeT */
23-
static $type = new IntRangeT(IntMinT::T, IntMaxT::T);
23+
static $type = new IntRangeT(null, null);
2424

2525
return $visitor->intRange($type);
2626
}

src/Alias/NegativeIntT.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Typhoon\Type\Alias;
66

77
use Typhoon\Type\IntRangeT;
8-
use Typhoon\Type\IntValueT;
98
use Typhoon\Type\Type;
109
use Typhoon\Type\TypeVisitor;
1110

@@ -21,7 +20,7 @@ enum NegativeIntT implements Type
2120
public function accept(TypeVisitor $visitor): mixed
2221
{
2322
/** @var IntRangeT */
24-
static $type = new IntRangeT(IntMinT::T, new IntValueT(-1));
23+
static $type = new IntRangeT(null, -1);
2524

2625
return $visitor->intRange($type);
2726
}

src/Alias/NonNegativeIntT.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Typhoon\Type\Alias;
66

77
use Typhoon\Type\IntRangeT;
8-
use Typhoon\Type\IntValueT;
98
use Typhoon\Type\Type;
109
use Typhoon\Type\TypeVisitor;
1110

@@ -21,7 +20,7 @@ enum NonNegativeIntT implements Type
2120
public function accept(TypeVisitor $visitor): mixed
2221
{
2322
/** @var IntRangeT */
24-
static $type = new IntRangeT(new IntValueT(0), IntMaxT::T);
23+
static $type = new IntRangeT(0, null);
2524

2625
return $visitor->intRange($type);
2726
}

src/Alias/NonPositiveIntT.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Typhoon\Type\Alias;
66

77
use Typhoon\Type\IntRangeT;
8-
use Typhoon\Type\IntValueT;
98
use Typhoon\Type\Type;
109
use Typhoon\Type\TypeVisitor;
1110

@@ -21,7 +20,7 @@ enum NonPositiveIntT implements Type
2120
public function accept(TypeVisitor $visitor): mixed
2221
{
2322
/** @var IntRangeT */
24-
static $type = new IntRangeT(IntMinT::T, new IntValueT(0));
23+
static $type = new IntRangeT(null, 0);
2524

2625
return $visitor->intRange($type);
2726
}

0 commit comments

Comments
 (0)