Closed rv1971 closed 3 years ago
Sorry, I don't understand what you are trying to fix here. Would you be able to add failing test case for this?
The attached testcase.zip (3 files) is the simplest test case I could derive from my data. If you run php-openapi convert --write-json openapi.json
on it, the result is
PHP Notice: Indirect modification of overloaded property cebe\openapi\spec\PathItem::$parameters has no effect in /home/rve/src/php-openapi/src/spec/PathItem.php on line 177 Notice: Indirect modification of overloaded property cebe\openapi\spec\PathItem::$parameters has no effect in /home/rve/src/php-openapi/src/spec/PathItem.php on line 177 { "openapi": "3.0.3", "info": { "title": "Foo", "version": "0.42.0" }, "paths": { "\/foo": { "servers": [], "parameters": [ { "name": "X-Param", "in": "header" } ] } } }
Actually, despite of the notices, the result seems to be correct. To be honest, I did never check the result as such because I think this kind of notices, which suggest there is something wrong in the code, is misleading and should be avoided.
Thank you!
With the previous code
$this->$attribute[$k] = $referencedObject
, PHP issuesNotice: Indirect modification of overloaded property cebe\openapi\spec\PathItem::$parameters has no effect
.The simplest fix I could think of is
$this->$attribute = [ $k => $referencedObject ] + $this->$attribute
.