Skip to content

Commit 369b5b0

Browse files
committed
TASK: Ensure that EnumStaticType instances are considered equivalents of themselves
1 parent e306c48 commit 369b5b0

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/TypeSystem/Type/EnumType/EnumStaticType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ enumName: $enumDeclarationNode->enumName
4040

4141
public function is(TypeInterface $other): bool
4242
{
43-
return false;
43+
return $other === $this;
4444
}
4545
}

test/Unit/TypeSystem/Type/EnumType/EnumStaticTypeTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,20 @@ public function providesNameOfTheEnum(): void
5757

5858
$this->assertEquals('SomeEnum', $enumStaticType->enumName);
5959
}
60+
61+
/**
62+
* @test
63+
* @return void
64+
*/
65+
public function isEquivalentToItself(): void
66+
{
67+
$enumDeclarationNode = EnumDeclarationNode::fromString(
68+
'enum SomeEnum {}'
69+
);
70+
$enumStaticType = EnumStaticType::fromEnumDeclarationNode(
71+
$enumDeclarationNode
72+
);
73+
74+
$this->assertTrue($enumStaticType->is($enumStaticType));
75+
}
6076
}

0 commit comments

Comments
 (0)