Skip to content

Commit eb5cf4e

Browse files
committed
WIP: TASK rename EnumType to EnumInstanceType
1 parent b310c5a commit eb5cf4e

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/TypeSystem/Resolver/Match/MatchTypeResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use PackageFactory\ComponentEngine\TypeSystem\ScopeInterface;
2929
use PackageFactory\ComponentEngine\TypeSystem\Type\BooleanType\BooleanType;
3030
use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumMemberType;
31-
use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumType;
31+
use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumInstanceType;
3232
use PackageFactory\ComponentEngine\TypeSystem\Type\UnionType\UnionType;
3333
use PackageFactory\ComponentEngine\TypeSystem\TypeInterface;
3434

@@ -87,7 +87,7 @@ private function resolveTypeOfBooleanMatch(MatchNode $matchNode): TypeInterface
8787
}
8888
}
8989

90-
private function resolveTypeOfEnumMatch(MatchNode $matchNode, EnumType $subjectEnumType): TypeInterface
90+
private function resolveTypeOfEnumMatch(MatchNode $matchNode, EnumInstanceType $subjectEnumType): TypeInterface
9191
{
9292
$expressionTypeResolver = new ExpressionTypeResolver(
9393
scope: $this->scope
@@ -149,7 +149,7 @@ public function resolveTypeOf(MatchNode $matchNode): TypeInterface
149149

150150
return match (true) {
151151
BooleanType::get()->is($typeOfSubject) => $this->resolveTypeOfBooleanMatch($matchNode),
152-
$typeOfSubject instanceof EnumType => $this->resolveTypeOfEnumMatch($matchNode, $typeOfSubject),
152+
$typeOfSubject instanceof EnumInstanceType => $this->resolveTypeOfEnumMatch($matchNode, $typeOfSubject),
153153
default => throw new \Exception('@TODO: Not handled ' . $typeOfSubject::class)
154154
};
155155
}

src/TypeSystem/Type/EnumType/EnumType.php renamed to src/TypeSystem/Type/EnumType/EnumInstanceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
use PackageFactory\ComponentEngine\TypeSystem\TypeInterface;
2626

27-
final class EnumType implements TypeInterface
27+
final class EnumInstanceType implements TypeInterface
2828
{
2929
use EnumTrait;
3030
}

src/TypeSystem/Type/EnumType/EnumMemberType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
final class EnumMemberType implements TypeInterface
2828
{
2929
public function __construct(
30-
public readonly EnumType|EnumStaticType $enumType,
30+
public readonly EnumInstanceType|EnumStaticType $enumType,
3131
public readonly string $memberName,
3232
public readonly ?TypeInterface $memberBackedValueType
3333
) {

src/TypeSystem/Type/EnumType/EnumStaticType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ final class EnumStaticType implements TypeInterface
2828
{
2929
use EnumTrait;
3030

31-
public function toEnumInstanceType(): EnumType
31+
public function toEnumInstanceType(): EnumInstanceType
3232
{
33-
return new EnumType($this->moduleId, $this->enumName, $this->membersWithType);
33+
return new EnumInstanceType($this->moduleId, $this->enumName, $this->membersWithType);
3434
}
3535
}

src/TypeSystem/Type/EnumType/EnumTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getMemberType(string $memberName): EnumMemberType
8383
public function is(TypeInterface $other): bool
8484
{
8585
return match ($other::class) {
86-
EnumType::class, EnumStaticType::class =>
86+
EnumInstanceType::class, EnumStaticType::class =>
8787
$this->moduleId === $other->moduleId
8888
&& $this->enumName === $other->enumName,
8989
default => false

test/Unit/TypeSystem/Type/EnumType/EnumTypeTest.php renamed to test/Unit/TypeSystem/Type/EnumType/EnumInstanceTypeTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
use PackageFactory\ComponentEngine\Module\ModuleId;
2626
use PackageFactory\ComponentEngine\Parser\Ast\EnumDeclarationNode;
27-
use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumType;
27+
use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumInstanceType;
2828
use PHPUnit\Framework\TestCase;
2929

30-
final class EnumTypeTest extends TestCase
30+
final class EnumInstanceTypeTest extends TestCase
3131
{
3232
/**
3333
* @test
@@ -38,12 +38,12 @@ public function canBeCreatedFromEnumDeclarationNode(): void
3838
$enumDeclarationNode = EnumDeclarationNode::fromString(
3939
'enum Foo { BAR BAZ }'
4040
);
41-
$enumType = EnumType::fromModuleIdAndDeclaration(
41+
$enumType = EnumInstanceType::fromModuleIdAndDeclaration(
4242
ModuleId::fromString("module-a"),
4343
$enumDeclarationNode
4444
);
4545

46-
$this->assertInstanceOf(EnumType::class, $enumType);
46+
$this->assertInstanceOf(EnumInstanceType::class, $enumType);
4747
}
4848

4949
/**
@@ -55,7 +55,7 @@ public function providesNameOfTheEnum(): void
5555
$enumDeclarationNode = EnumDeclarationNode::fromString(
5656
'enum SomeEnum {}'
5757
);
58-
$enumType = EnumType::fromModuleIdAndDeclaration(
58+
$enumType = EnumInstanceType::fromModuleIdAndDeclaration(
5959
ModuleId::fromString("module-a"),
6060
$enumDeclarationNode
6161
);

0 commit comments

Comments
 (0)