Skip to content

Commit e306c48

Browse files
committed
TASK: Ensure that ComponentType instances are considered equivalents of themselves
1 parent a23e06d commit e306c48

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/TypeSystem/Type/ComponentType/ComponentType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ public static function fromComponentDeclarationNode(ComponentDeclarationNode $co
4040

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

test/Unit/TypeSystem/Type/ComponentType/ComponentTypeTest.php

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

6060
$this->assertEquals('SomeComponent', $componentType->componentName);
6161
}
62+
63+
/**
64+
* @test
65+
* @return void
66+
*/
67+
public function isEquivalentToItself(): void
68+
{
69+
$componentDeclarationNode = ComponentDeclarationNode::fromString(
70+
'component SomeComponent { return "" }'
71+
);
72+
$componentType = ComponentType::fromComponentDeclarationNode(
73+
$componentDeclarationNode
74+
);
75+
76+
$this->assertTrue($componentType->is($componentType));
77+
}
6278
}

0 commit comments

Comments
 (0)