From 61242377d67960dcfeeef45aa180e346ffc569a8 Mon Sep 17 00:00:00 2001 From: Martin Rademacher Date: Fri, 8 Sep 2023 10:22:14 +1200 Subject: [PATCH] Ignore unexpected properties (#1476) --- src/Annotations/AbstractAnnotation.php | 3 +-- tests/Annotations/AbstractAnnotationTest.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Annotations/AbstractAnnotation.php b/src/Annotations/AbstractAnnotation.php index c3f2af6d..a6e27785 100644 --- a/src/Annotations/AbstractAnnotation.php +++ b/src/Annotations/AbstractAnnotation.php @@ -165,8 +165,7 @@ public function __set(string $property, $value): void foreach (static::$_blacklist as $_property) { unset($fields[$_property]); } - $this->_context->logger->warning('Unexpected field "' . $property . '" for ' . $this->identity() . ', expecting "' . implode('", "', array_keys($fields)) . '" in ' . $this->_context); - $this->{$property} = $value; + $this->_context->logger->warning('Ignoring unexpected property "' . $property . '" for ' . $this->identity() . ', expecting "' . implode('", "', array_keys($fields)) . '" in ' . $this->_context); } /** diff --git a/tests/Annotations/AbstractAnnotationTest.php b/tests/Annotations/AbstractAnnotationTest.php index 935ed0ff..43ed5522 100644 --- a/tests/Annotations/AbstractAnnotationTest.php +++ b/tests/Annotations/AbstractAnnotationTest.php @@ -25,7 +25,7 @@ public function testVendorFields(): void */ public function testInvalidField(): void { - $this->assertOpenApiLogEntryContains('Unexpected field "doesnot" for @OA\Get(), expecting'); + $this->assertOpenApiLogEntryContains('Ignoring unexpected property "doesnot" for @OA\Get(), expecting'); $this->annotationsFromDocBlockParser('@OA\Get(doesnot="exist")'); }