Skip to content

Use phpstan's int-mask-of<T> #779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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