diff --git a/src/Annotations/AbstractAnnotation.php b/src/Annotations/AbstractAnnotation.php index ec5ffa36f..9057d0519 100644 --- a/src/Annotations/AbstractAnnotation.php +++ b/src/Annotations/AbstractAnnotation.php @@ -136,8 +136,7 @@ public function __set($property, $value) foreach (static::$_blacklist as $_property) { unset($fields[$_property]); } - Logger::notice('Unexpected field "' . $property . '" for ' . $this->identity() . ', expecting "' . implode('", "', array_keys($fields)) . '" in ' . $this->_context); - $this->$property = $value; + Logger::notice('Ignoring unexpected property "' . $property . '" for ' . $this->identity() . ', expecting "' . implode('", "', array_keys($fields)) . '" in ' . $this->_context); } /** diff --git a/src/Context.php b/src/Context.php index 698ad817b..a87850794 100644 --- a/src/Context.php +++ b/src/Context.php @@ -33,6 +33,7 @@ * @property string $property * @property Annotations\AbstractAnnotation[] $annotations */ +#[\AllowDynamicProperties] class Context { /** @@ -282,7 +283,7 @@ public function fullyQualifiedName($class) } else { $namespace = '\\'; // global namespace } - if (strcasecmp($class, $this->class) === 0) { + if (strcasecmp((string) $class, (string) $this->class) === 0) { return $namespace . $this->class; } $pos = strpos($class, '\\'); diff --git a/tests/AbstractAnnotationTest.php b/tests/AbstractAnnotationTest.php index 799c40293..4bd47af22 100644 --- a/tests/AbstractAnnotationTest.php +++ b/tests/AbstractAnnotationTest.php @@ -18,7 +18,7 @@ public function testVendorFields() public function testInvalidField() { - $this->assertSwaggerLogEntryStartsWith('Unexpected field "doesnot" for @SWG\Get(), expecting'); + $this->assertSwaggerLogEntryStartsWith('Ignoring unexpected property "doesnot" for @SWG\Get(), expecting'); $this->parseComment('@SWG\Get(doesnot="exist")'); }