diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index aaa7831a..d708b079 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -900,33 +900,3 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php - - - message: "#^Method JsonSchema\\\\Validator\\:\\:check\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - - - message: "#^Method JsonSchema\\\\Validator\\:\\:check\\(\\) has parameter \\$schema with no type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - - - message: "#^Method JsonSchema\\\\Validator\\:\\:check\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - - - message: "#^Method JsonSchema\\\\Validator\\:\\:coerce\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - - - message: "#^Method JsonSchema\\\\Validator\\:\\:coerce\\(\\) has parameter \\$schema with no type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - - - message: "#^Method JsonSchema\\\\Validator\\:\\:coerce\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - diff --git a/src/JsonSchema/Validator.php b/src/JsonSchema/Validator.php index bf172640..d8c83876 100644 --- a/src/JsonSchema/Validator.php +++ b/src/JsonSchema/Validator.php @@ -41,14 +41,11 @@ class Validator extends BaseConstraint * * @param mixed $value * @param mixed $schema - * @param int $checkMode - * - * @return int * * @phpstan-param int-mask-of $checkMode * @phpstan-return int-mask-of */ - public function validate(&$value, $schema = null, $checkMode = null) + public function validate(&$value, $schema = null, ?int $checkMode = null): int { // reset errors prior to validation $this->reset(); @@ -82,9 +79,14 @@ public function validate(&$value, $schema = null, $checkMode = null) /** * Alias to validate(), to maintain backwards-compatibility with the previous API * - * @deprecated + * @deprecated since 6.0.0, use Validator::validate() instead, to be removed in 7.0 + * + * @param mixed $value + * @param mixed $schema + * + * @phpstan-return int-mask-of */ - public function check($value, $schema) + public function check($value, $schema): int { return $this->validate($value, $schema); } @@ -92,9 +94,14 @@ public function check($value, $schema) /** * Alias to validate(), to maintain backwards-compatibility with the previous API * - * @deprecated + * @deprecated since 6.0.0, use Validator::validate() instead, to be removed in 7.0 + * + * @param mixed $value + * @param mixed $schema + * + * @phpstan-return int-mask-of */ - public function coerce(&$value, $schema) + public function coerce(&$value, $schema): int { return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES); }