Skip to content

Commit

Permalink
Use phpstan's int-mask-of<T> (#779)
Browse files Browse the repository at this point in the history
* Better phpstan typing

* Better phpstan typing
  • Loading branch information
jack-worman authored Feb 6, 2025
1 parent f7d78c3 commit 56f34b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

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

## [6.1.0] - 2025-02-04
### Added
Expand Down Expand Up @@ -91,4 +93,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix: Clean up `.gitattributes` ([#687](https://github.com/jsonrainbow/json-schema/pull/687))
- Fix: Order `friendsofphp/php-cs-fixer` rules ([#688](https://github.com/jsonrainbow/json-schema/pull/688))
- HTTP to HTTPS redirection breaks remote reference resolution ([#709](https://github.com/jsonrainbow/json-schema/pull/709))
- Corrected several typos and code style issues
- Corrected several typos and code style issues
2 changes: 2 additions & 0 deletions src/JsonSchema/Constraints/BaseConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class BaseConstraint

/**
* @var int All error types which have occurred
* @phpstan-var int-mask-of<Validator::ERROR_*>
*/
protected $errorMask = Validator::ERROR_NONE;

Expand Down Expand Up @@ -129,6 +130,7 @@ public function reset()
* Get the error mask
*
* @return int
* @phpstan-return int-mask-of<Validator::ERROR_*>
*/
public function getErrorMask()
{
Expand Down
3 changes: 2 additions & 1 deletion src/JsonSchema/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class Validator extends BaseConstraint
*
* @return int
*
* @phpstan-param Constraint::CHECK_MODE_* $checkMode
* @phpstan-param int-mask-of<Constraint::CHECK_MODE_*> $checkMode
* @phpstan-return int-mask-of<Validator::ERROR_*>
*/
public function validate(&$value, $schema = null, $checkMode = null)
{
Expand Down

0 comments on commit 56f34b8

Please sign in to comment.