Skip to content

Commit a06db02

Browse files
committed
Allow possibly undefined property on left side of ??
1 parent 9298ddc commit a06db02

20 files changed

+198
-9
lines changed

src/Reflection/Annotations/AnnotationPropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,9 @@ public function getAttributes(): array
159159
return [];
160160
}
161161

162+
public function isDummy(): TrinaryLogic
163+
{
164+
return TrinaryLogic::createNo();
165+
}
166+
162167
}

src/Reflection/Dummy/ChangedTypePropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,9 @@ public function getAttributes(): array
156156
return $this->reflection->getAttributes();
157157
}
158158

159+
public function isDummy(): TrinaryLogic
160+
{
161+
return $this->reflection->isDummy();
162+
}
163+
159164
}

src/Reflection/Dummy/DummyPropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,9 @@ public function getAttributes(): array
156156
return [];
157157
}
158158

159+
public function isDummy(): TrinaryLogic
160+
{
161+
return TrinaryLogic::createYes();
162+
}
163+
159164
}

src/Reflection/ExtendedPropertyReflection.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,12 @@ public function isPrivateSet(): bool;
6363
*/
6464
public function getAttributes(): array;
6565

66+
/**
67+
* If property has been declared in code then this returns `no()`
68+
*
69+
* Returns `yes()` if the property represents possibly-defined property
70+
* in non-final classes, on mixed, on object etc.
71+
*/
72+
public function isDummy(): TrinaryLogic;
73+
6674
}

src/Reflection/Php/EnumPropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,9 @@ public function getAttributes(): array
152152
return [];
153153
}
154154

155+
public function isDummy(): TrinaryLogic
156+
{
157+
return TrinaryLogic::createNo();
158+
}
159+
155160
}

src/Reflection/Php/PhpPropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,9 @@ public function getAttributes(): array
295295
return $this->attributes;
296296
}
297297

298+
public function isDummy(): TrinaryLogic
299+
{
300+
return TrinaryLogic::createNo();
301+
}
302+
298303
}

src/Reflection/Php/SimpleXMLElementProperty.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,9 @@ public function getAttributes(): array
167167
return [];
168168
}
169169

170+
public function isDummy(): TrinaryLogic
171+
{
172+
return TrinaryLogic::createNo();
173+
}
174+
170175
}

src/Reflection/Php/UniversalObjectCrateProperty.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,9 @@ public function getAttributes(): array
157157
return [];
158158
}
159159

160+
public function isDummy(): TrinaryLogic
161+
{
162+
return TrinaryLogic::createNo();
163+
}
164+
160165
}

src/Reflection/ResolvedPropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,9 @@ public function getAttributes(): array
208208
return $this->reflection->getAttributes();
209209
}
210210

211+
public function isDummy(): TrinaryLogic
212+
{
213+
return $this->reflection->isDummy();
214+
}
215+
211216
}

src/Reflection/Type/IntersectionTypePropertyReflection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,11 @@ public function getAttributes(): array
205205
return $this->properties[0]->getAttributes();
206206
}
207207

208+
public function isDummy(): TrinaryLogic
209+
{
210+
// uses method typical for unions
211+
// because for this to return yes(), all methods should be dummy
212+
return TrinaryLogic::lazyExtremeIdentity($this->properties, static fn (ExtendedPropertyReflection $propertyReflection): TrinaryLogic => $propertyReflection->isAbstract());
213+
}
214+
208215
}

0 commit comments

Comments
 (0)