From 457d15287f8ba5a19a9c027cb6d9984c8d8a6e94 Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Sun, 5 Apr 2020 06:30:02 +0700 Subject: [PATCH] Fix PHP 8 deprecation notices on required parameters appearing after optional parameters. This is related to #619, where the fix was applied on the master branch. This commit backports them to 5.x.x branch. From PHP 8.0 and forwards, a deprecation notice is raised if there are required parameters after optional parameters in a function/method signature. See https://php.watch/versions/8.0/deprecate-required-param-after-optional for details. --- src/JsonSchema/Constraints/UndefinedConstraint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index e194cb0e..aaf714dd 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -59,7 +59,7 @@ public function check(&$value, $schema = null, JsonPointer $path = null, $i = nu * @param JsonPointer $path * @param string $i */ - public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null) + public function validateTypes(&$value, $schema, JsonPointer $path, $i = null) { // check array if ($this->getTypeCheck()->isArray($value)) { @@ -105,7 +105,7 @@ public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = n * @param JsonPointer $path * @param string $i */ - protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '') + protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '') { // if it extends another schema, it must pass that schema as well if (isset($schema->extends)) {