Skip to content

Commit

Permalink
Merge pull request #663 from ergebnis/fix/condition
Browse files Browse the repository at this point in the history
Fix: Harden condition
  • Loading branch information
localheinz committed Jan 29, 2022
2 parents 3e90011 + b9afd93 commit bcf59d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions psalm-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<files psalm-version="4.19.0@a2ad69ae4f5ab1f7d225a8dc4e2ec2d9415ed599">
<file src="src/CallableNormalizer.php">
<MixedInferredReturnType occurrences="1">
<code>Json</code>
Expand All @@ -21,13 +21,12 @@
<MissingParamType occurrences="1">
<code>$data</code>
</MissingParamType>
<MixedArgument occurrences="8">
<MixedArgument occurrences="7">
<code>$anyOfSchema</code>
<code>$item</code>
<code>$item</code>
<code>$itemSchema</code>
<code>$oneOfSchema</code>
<code>$schema-&gt;properties</code>
<code>$value</code>
<code>$value</code>
</MixedArgument>
Expand Down
5 changes: 4 additions & 1 deletion src/SchemaNormalizer.php
Expand Up @@ -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<string, \stdClass> $objectPropertiesThatAreDefinedBySchema */
$objectPropertiesThatAreDefinedBySchema = \array_intersect_key(
\get_object_vars($schema->properties),
Expand Down

0 comments on commit bcf59d6

Please sign in to comment.