Skip to content

Commit

Permalink
Remove obsolete check if FILTER_FLAG_EMAIL_UNICODE is defined (#772)
Browse files Browse the repository at this point in the history
* Remove obsolete check because PHP 7.1 or lower is not supported anymore

* Refresh phpstan baseline

* Add changelog
  • Loading branch information
W0rma authored Jan 20, 2025
1 parent 14e41d8 commit d212eca
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `strict_types=1` to all classes in ./src ([#758](https://github.com/jsonrainbow/json-schema/pull/758))
- Raise minimum level of marc-mabe/php-enum ([#766](https://github.com/jsonrainbow/json-schema/pull/766))
- Cleanup test from @param annotations ([#768](https://github.com/jsonrainbow/json-schema/pull/768))
- Remove obsolete PHP 7.1 version check ([#772](https://github.com/jsonrainbow/json-schema/pull/772))

## [6.0.0] - 2024-07-30
### Added
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/FormatConstraint.php

-
message: "#^Strict comparison using \\=\\=\\= between null and non\\-falsy\\-string\\|false will always evaluate to false\\.$#"
count: 1
path: src/JsonSchema/Constraints/FormatConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
7 changes: 1 addition & 6 deletions src/JsonSchema/Constraints/FormatConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $i =
break;

case 'email':
$filterFlags = FILTER_NULL_ON_FAILURE;
if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
// Only available from PHP >= 7.1.0, so ignore it for coverage checks
$filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE'); // @codeCoverageIgnore
}
if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
if (null === filter_var($element, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE | FILTER_FLAG_EMAIL_UNICODE)) {
$this->addError(ConstraintError::FORMAT_EMAIL(), $path, ['format' => $schema->format]);
}
break;
Expand Down

0 comments on commit d212eca

Please sign in to comment.