Skip to content

Commit 2d01b86

Browse files
Solve todo
1 parent 5e4e3d8 commit 2d01b86

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/Reflection/Php/PhpClassReflectionExtension.php

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ public function getNativeProperty(ClassReflection $classReflection, string $prop
216216
return $this->nativeProperties[$classReflection->getCacheKey()][$propertyName];
217217
}
218218

219-
// TODO: Find the difference between createInstanceProperty and createStaticProperty
220219
private function createProperty(
221220
ClassReflection $classReflection,
222221
string $propertyName,

src/Type/Accessory/HasPropertyType.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
7272

7373
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
7474
{
75-
// TODO
76-
return new IsSuperTypeOfResult($type->hasProperty($this->propertyName), []);
75+
return new IsSuperTypeOfResult(
76+
$type->hasInstanceProperty($this->propertyName)->or($type->hasStaticProperty($this->propertyName)),
77+
[],
78+
);
7779
}
7880

7981
public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
@@ -88,8 +90,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
8890
$limit = IsSuperTypeOfResult::createMaybe();
8991
}
9092

91-
// TODO
92-
return $limit->and(new IsSuperTypeOfResult($otherType->hasProperty($this->propertyName), []));
93+
return $limit->and(new IsSuperTypeOfResult(
94+
$otherType->hasInstanceProperty($this->propertyName)->or($otherType->hasStaticProperty($this->propertyName)),
95+
[],
96+
));
9397
}
9498

9599
public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
@@ -122,7 +126,6 @@ public function hasProperty(string $propertyName): TrinaryLogic
122126
return TrinaryLogic::createMaybe();
123127
}
124128

125-
// TODO
126129
public function hasInstanceProperty(string $propertyName): TrinaryLogic
127130
{
128131
if ($this->propertyName === $propertyName) {
@@ -132,7 +135,6 @@ public function hasInstanceProperty(string $propertyName): TrinaryLogic
132135
return TrinaryLogic::createMaybe();
133136
}
134137

135-
// TODO
136138
public function hasStaticProperty(string $propertyName): TrinaryLogic
137139
{
138140
if ($this->propertyName === $propertyName) {

0 commit comments

Comments
 (0)