Skip to content

Commit 56f34b8

Browse files
authored
Use phpstan's int-mask-of<T> (#779)
* Better phpstan typing * Better phpstan typing
1 parent f7d78c3 commit 56f34b8

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Changed
10+
- Used PHPStan's int-mask-of<T> type where applicable ([#779](https://github.com/jsonrainbow/json-schema/pull/779))
911

1012
## [6.1.0] - 2025-02-04
1113
### Added
@@ -91,4 +93,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9193
- Fix: Clean up `.gitattributes` ([#687](https://github.com/jsonrainbow/json-schema/pull/687))
9294
- Fix: Order `friendsofphp/php-cs-fixer` rules ([#688](https://github.com/jsonrainbow/json-schema/pull/688))
9395
- HTTP to HTTPS redirection breaks remote reference resolution ([#709](https://github.com/jsonrainbow/json-schema/pull/709))
94-
- Corrected several typos and code style issues
96+
- Corrected several typos and code style issues

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)