Skip to content

Commit 54d9d01

Browse files
izuckenrv1971
authored andcommitted
Fix PathItem::resolveReferences() for array fields
Fixed path references resolution fail tied to a dynamic prop modification: dynamic attribute array references were not resolving, producing an E_NOTICE. The previous code `$this->$attribute[$k] = $referencedObject` had no effect if the value of `$attribute` is an array (as for instance in the case of `parameters`), because `$this->$attribute` invokes `SpecBaseObject::__get()`, which does *not* return a reference. Indeed PHP issued `Notice: Indirect modification of overloaded property cebe\openapi\spec\PathItem::$parameters has no effect` in this case. close #87 close #102 Co-authored-by: rv1971 <[email protected]>
1 parent 6d2a7bb commit 54d9d01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/spec/PathItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function resolveReferences(ReferenceContext $context = null)
180180
foreach ($this->$attribute as $k => $item) {
181181
if ($item instanceof Reference) {
182182
$referencedObject = $item->resolve();
183-
$this->$attribute[$k] = $referencedObject;
183+
$this->$attribute = [$k => $referencedObject] + $this->$attribute;
184184
if (!$referencedObject instanceof Reference && $referencedObject !== null) {
185185
$referencedObject->resolveReferences();
186186
}

0 commit comments

Comments
 (0)