Skip to content

Commit a1c18c1

Browse files
lucasmichotLucas Michot
authored andcommitted
Update validateJsonSchema
1 parent 24efdfb commit a1c18c1

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
@@ -1645,13 +1645,11 @@ public function validateJson($attribute, $value)
16451645
*/
16461646
public function validateJsonSchema($attribute, $value, $parameters): bool
16471647
{
1648-
if (! isset($parameters[0]) || ! $parameters[0] instanceof Type) {
1648+
if (! ($parameters[0] ?? null) instanceof Type) {
16491649
throw new InvalidArgumentException('The json_schema rule requires a JsonSchema Type instance.');
16501650
}
16511651

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

16571655
/**

0 commit comments

Comments
 (0)