From 01b75ce7cb5913017b7aa6ba743f845ae7a3dbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Hud=C3=A1k?= <80049705+Vlado-web@users.noreply.github.com> Date: Sat, 6 Jan 2024 19:28:09 +0100 Subject: [PATCH] Check if variable array key exists before execution method (#2182) * Check if variable array key exists before execution method * fix formatting * use array function for check * attempt to fix style issue --------- Co-authored-by: Vlado Hudak --- OpenApiPhp/Util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenApiPhp/Util.php b/OpenApiPhp/Util.php index dc0db90e8..8a3537f56 100644 --- a/OpenApiPhp/Util.php +++ b/OpenApiPhp/Util.php @@ -424,7 +424,7 @@ private static function mergeFromArray(OA\AbstractAnnotation $annotation, array if ('$ref' === $propertyName) { $propertyName = 'ref'; } - if (!\in_array($propertyName, $done, true)) { + if (array_key_exists($propertyName, $defaults) && !\in_array($propertyName, $done, true)) { self::mergeProperty($annotation, $propertyName, $value, $defaults[$propertyName], $overwrite); } }