From b9afd93f00a4aee4d9c37cdd1b7421b0bad10725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sat, 29 Jan 2022 23:22:47 +0100 Subject: [PATCH] Fix: Harden condition --- psalm-baseline.xml | 5 ++--- src/SchemaNormalizer.php | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index fce90ef9..68e315c6 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + Json @@ -21,13 +21,12 @@ $data - + $anyOfSchema $item $item $itemSchema $oneOfSchema - $schema->properties $value $value diff --git a/src/SchemaNormalizer.php b/src/SchemaNormalizer.php index dbf22a24..fef7da24 100644 --- a/src/SchemaNormalizer.php +++ b/src/SchemaNormalizer.php @@ -177,7 +177,10 @@ private function normalizeObject( /** * @see https://json-schema.org/understanding-json-schema/reference/object.html#properties */ - if (\property_exists($schema, 'properties')) { + if ( + \property_exists($schema, 'properties') + && \is_object($schema->properties) + ) { /** @var array $objectPropertiesThatAreDefinedBySchema */ $objectPropertiesThatAreDefinedBySchema = \array_intersect_key( \get_object_vars($schema->properties),