Skip to content

Commit 38ad897

Browse files
committed
Update validateJsonSchema
1 parent 8b19cd8 commit 38ad897

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,13 +1646,11 @@ public function validateJson($attribute, $value)
16461646
*/
16471647
public function validateJsonSchema($attribute, $value, $parameters): bool
16481648
{
1649-
if (! isset($parameters[0]) || ! $parameters[0] instanceof Type) {
1649+
if (! ($parameters[0] ?? null) instanceof Type) {
16501650
throw new InvalidArgumentException('The json_schema rule requires a JsonSchema Type instance.');
16511651
}
16521652

1653-
$rule = new JsonSchemaRule($parameters[0]);
1654-
1655-
return $rule->passes($attribute, $value);
1653+
return (new JsonSchemaRule($parameters[0]))->passes($attribute, $value);
16561654
}
16571655

16581656
/**

0 commit comments

Comments
 (0)