Skip to content

Commit b8f8dbb

Browse files
committed
Generated types
1 parent 9a103ae commit b8f8dbb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2515
-17
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.github/ export-ignore
22
/stubs/ export-ignore
33
/tests/ export-ignore
4+
/tools/ export-ignore
45
/.gitattributes export-ignore
56
/.gitignore export-ignore
67
/.php-cs-fixer.dist.php export-ignore

.github/workflows/check.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ jobs:
99
secrets: inherit
1010
with:
1111
infection: false
12-
phpstan: false
1312
psalm: true

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Finder::create()
1313
->in(__DIR__ . '/src')
1414
->in(__DIR__ . '/tests')
15+
->in(__DIR__ . '/tools/generator/src')
1516
->append([
1617
__FILE__,
1718
]),

composer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
},
2424
"autoload": {
2525
"psr-4": {
26-
"Typhoon\\Type\\": "src/",
27-
"Typhoon\\TypeSpec\\": "spec/"
28-
}
26+
"Typhoon\\Type\\": "src/"
27+
},
28+
"files": [
29+
"src/types.php"
30+
]
2931
},
3032
"autoload-dev": {
3133
"psr-4": {
@@ -53,6 +55,10 @@
5355
"check-require": "tools/composer-require-checker/vendor/bin/composer-require-checker",
5456
"check-unused": "tools/composer-unused/vendor/bin/composer-unused",
5557
"fixcs": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --verbose",
58+
"generate": [
59+
"@php tools/generator/src/generate.php",
60+
"git add ."
61+
],
5662
"infection": "tools/infection/vendor/bin/infection --show-mutations",
5763
"normalize": "@composer bin composer-normalize normalize --diff ../../composer.json",
5864
"phpstan": "tools/phpstan/vendor/bin/phpstan analyze",

psalm.xml.dist

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@
3838
<classAndDescendants name="RuntimeException"/>
3939
</ignoreExceptions>
4040

41-
<issueHandlers>
42-
<PluginIssue name="UnspecifiedVisibility">
43-
<errorLevel type="suppress">
44-
<directory name="tests"/>
45-
</errorLevel>
46-
</PluginIssue>
47-
<MissingThrowsDocblock>
48-
<errorLevel type="suppress">
49-
<directory name="tests"/>
50-
</errorLevel>
51-
</MissingThrowsDocblock>
52-
</issueHandlers>
53-
5441
<forbiddenFunctions>
5542
<function name="dd"/>
5643
<function name="die"/>

src/.gitignore

Whitespace-only changes.

src/Alias/ArrayKeyT.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Typhoon\Type\Alias;
6+
7+
use Typhoon\Type\StringT;
8+
use Typhoon\Type\Type;
9+
use Typhoon\Type\TypeVisitor;
10+
use Typhoon\Type\UnionT;
11+
12+
/**
13+
* @internal
14+
* @psalm-internal Typhoon\Type
15+
* @implements Type<array-key>
16+
*/
17+
enum ArrayKeyT implements Type
18+
{
19+
case T;
20+
21+
public function accept(TypeVisitor $visitor): mixed
22+
{
23+
/** @var UnionT */
24+
static $type = new UnionT([
25+
IntT::T,
26+
StringT::T,
27+
]);
28+
29+
return $visitor->union($type);
30+
}
31+
}

src/Alias/BoolT.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Typhoon\Type\Alias;
6+
7+
use Typhoon\Type\FalseT;
8+
use Typhoon\Type\TrueT;
9+
use Typhoon\Type\Type;
10+
use Typhoon\Type\TypeVisitor;
11+
use Typhoon\Type\UnionT;
12+
13+
/**
14+
* @internal
15+
* @psalm-internal Typhoon\Type
16+
* @implements Type<bool>
17+
*/
18+
enum BoolT implements Type
19+
{
20+
case T;
21+
22+
public function accept(TypeVisitor $visitor): mixed
23+
{
24+
/** @var UnionT */
25+
static $type = new UnionT([
26+
FalseT::T,
27+
TrueT::T,
28+
]);
29+
30+
return $visitor->union($type);
31+
}
32+
}

src/Alias/FloatMaxT.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Typhoon\Type\Alias;
6+
7+
use Typhoon\Type\ConstantT;
8+
use Typhoon\Type\Type;
9+
use Typhoon\Type\TypeVisitor;
10+
11+
/**
12+
* @internal
13+
* @psalm-internal Typhoon\Type
14+
* @implements Type<float>
15+
*/
16+
enum FloatMaxT implements Type
17+
{
18+
case T;
19+
20+
public function accept(TypeVisitor $visitor): mixed
21+
{
22+
/** @var ConstantT */
23+
static $type = new ConstantT('PHP_FLOAT_MAX');
24+
25+
return $visitor->constant($type);
26+
}
27+
}

src/Alias/FloatMinT.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Typhoon\Type\Alias;
6+
7+
use Typhoon\Type\ConstantT;
8+
use Typhoon\Type\Type;
9+
use Typhoon\Type\TypeVisitor;
10+
11+
/**
12+
* @internal
13+
* @psalm-internal Typhoon\Type
14+
* @implements Type<float>
15+
*/
16+
enum FloatMinT implements Type
17+
{
18+
case T;
19+
20+
public function accept(TypeVisitor $visitor): mixed
21+
{
22+
/** @var ConstantT */
23+
static $type = new ConstantT('PHP_FLOAT_MIN');
24+
25+
return $visitor->constant($type);
26+
}
27+
}

0 commit comments

Comments
 (0)