Skip to content

Commit 7b956a3

Browse files
committed
refactor: resolve phpstan findings from baseline
1 parent e199ea2 commit 7b956a3

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/JsonSchema/Validator.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,11 @@ class Validator extends BaseConstraint
4141
*
4242
* @param mixed $value
4343
* @param mixed $schema
44-
* @param int $checkMode
45-
*
46-
* @return int
4744
*
4845
* @phpstan-param int-mask-of<Constraint::CHECK_MODE_*> $checkMode
4946
* @phpstan-return int-mask-of<Validator::ERROR_*>
5047
*/
51-
public function validate(&$value, $schema = null, $checkMode = null)
48+
public function validate(&$value, $schema = null, int $checkMode = null): int
5249
{
5350
// reset errors prior to validation
5451
$this->reset();
@@ -82,19 +79,29 @@ public function validate(&$value, $schema = null, $checkMode = null)
8279
/**
8380
* Alias to validate(), to maintain backwards-compatibility with the previous API
8481
*
85-
* @deprecated
82+
* @deprecated since 6.0.0, use Validator::validate() instead, to be removed in 7.0
83+
*
84+
* @param mixed $value
85+
* @param mixed $schema
86+
*
87+
* @phpstan-return int-mask-of<Validator::ERROR_*>
8688
*/
87-
public function check($value, $schema)
89+
public function check($value, $schema): int
8890
{
8991
return $this->validate($value, $schema);
9092
}
9193

9294
/**
9395
* Alias to validate(), to maintain backwards-compatibility with the previous API
9496
*
95-
* @deprecated
97+
* @deprecated since 6.0.0, use Validator::validate() instead, to be removed in 7.0
98+
*
99+
* @param mixed $value
100+
* @param mixed $schema
101+
*
102+
* @phpstan-return int-mask-of<Validator::ERROR_*>
96103
*/
97-
public function coerce(&$value, $schema)
104+
public function coerce(&$value, $schema): int
98105
{
99106
return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
100107
}

0 commit comments

Comments
 (0)