Skip to content

Commit adebe64

Browse files
Try
1 parent 8f4e3bc commit adebe64

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

src/Type/ObjectShapeType.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,14 @@ public function getUnresolvedPropertyPrototype(string $propertyName, ClassMember
113113

114114
public function hasInstanceProperty(string $propertyName): TrinaryLogic
115115
{
116-
if (!array_key_exists($propertyName, $this->properties)) {
117-
return TrinaryLogic::createNo();
118-
}
119-
120-
if (in_array($propertyName, $this->optionalProperties, true)) {
121-
return TrinaryLogic::createMaybe();
116+
if (
117+
array_key_exists($propertyName, $this->properties)
118+
&& in_array($propertyName, $this->optionalProperties, true)
119+
) {
120+
return TrinaryLogic::createYes();
122121
}
123122

124-
return TrinaryLogic::createYes();
123+
return TrinaryLogic::createMaybe();
125124
}
126125

127126
public function getInstanceProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
@@ -297,10 +296,6 @@ public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
297296
foreach ($this->properties as $propertyName => $propertyType) {
298297
$hasProperty = new IsSuperTypeOfResult($type->hasInstanceProperty((string) $propertyName), []);
299298
if ($hasProperty->no()) {
300-
if ($type instanceof self) {
301-
$result = $result->and(IsSuperTypeOfResult::createMaybe());
302-
continue;
303-
}
304299
if (in_array($propertyName, $this->optionalProperties, true)) {
305300
continue;
306301
}

0 commit comments

Comments
 (0)