Skip to content

Commit

Permalink
Prettify checks for getting childSchema of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
nektru authored and scaytrase committed Jan 6, 2021
1 parent f89d2f9 commit a666a09
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/PSR7/Validators/SerializedParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use function explode;
use function in_array;
use function is_array;
use function is_bool;
use function is_float;
use function is_int;
use function is_numeric;
Expand Down Expand Up @@ -202,11 +201,11 @@ public function getSchema(): CebeSchema
protected function getChildSchema(CebeSchema $schema, string $key): ?CebeSchema
{
if ($schema->type === CebeType::OBJECT) {
if ($schema->properties[$key] ?? false) {
if (($schema->properties[$key] ?? false) && $schema->properties[$key] instanceof CebeSchema) {
return $schema->properties[$key];
}

if (! is_bool($schema->additionalProperties) && $schema->additionalProperties instanceof CebeSchema) {
if ($schema->additionalProperties instanceof CebeSchema) {
return $schema->additionalProperties;
}
}
Expand Down

0 comments on commit a666a09

Please sign in to comment.