Skip to content

Commit 791de98

Browse files
committed
Better phpstan typing
1 parent f7d78c3 commit 791de98

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

phpstan-baseline.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ parameters:
451451
path: src/JsonSchema/Constraints/StringConstraint.php
452452

453453
-
454-
message: "#^Parameter \\#2 \\$encoding of function mb_strlen expects string, string\\|false given\\.$#"
454+
message: "#^Parameter \\#2 \\$encoding of function mb_strlen expects string\\|null, string\\|false given\\.$#"
455455
count: 1
456456
path: src/JsonSchema/Constraints/StringConstraint.php
457457

@@ -971,7 +971,7 @@ parameters:
971971
path: src/JsonSchema/Uri/Retrievers/FileGetContents.php
972972

973973
-
974-
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int, array\\)\\: bool\\)\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#"
974+
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int\\)\\: bool\\)\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#"
975975
count: 1
976976
path: src/JsonSchema/Uri/Retrievers/FileGetContents.php
977977

src/JsonSchema/Constraints/BaseConstraint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class BaseConstraint
3030

3131
/**
3232
* @var int All error types which have occurred
33+
* @phpstan-var int-mask-of<Validator::ERROR_*>
3334
*/
3435
protected $errorMask = Validator::ERROR_NONE;
3536

@@ -129,6 +130,7 @@ public function reset()
129130
* Get the error mask
130131
*
131132
* @return int
133+
* @phpstan-return int-mask-of<Validator::ERROR_*>
132134
*/
133135
public function getErrorMask()
134136
{

src/JsonSchema/Validator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class Validator extends BaseConstraint
4444
*
4545
* @return int
4646
*
47-
* @phpstan-param Constraint::CHECK_MODE_* $checkMode
47+
* @phpstan-param int-mask-of<Constraint::CHECK_MODE_*> $checkMode
48+
* @phpstan-return int-mask-of<Validator::ERROR_*>
4849
*/
4950
public function validate(&$value, $schema = null, $checkMode = null)
5051
{

0 commit comments

Comments
 (0)