Skip to content

Commit d212eca

Browse files
authored
Remove obsolete check if FILTER_FLAG_EMAIL_UNICODE is defined (#772)
* Remove obsolete check because PHP 7.1 or lower is not supported anymore * Refresh phpstan baseline * Add changelog
1 parent 14e41d8 commit d212eca

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Add `strict_types=1` to all classes in ./src ([#758](https://github.com/jsonrainbow/json-schema/pull/758))
3131
- Raise minimum level of marc-mabe/php-enum ([#766](https://github.com/jsonrainbow/json-schema/pull/766))
3232
- Cleanup test from @param annotations ([#768](https://github.com/jsonrainbow/json-schema/pull/768))
33+
- Remove obsolete PHP 7.1 version check ([#772](https://github.com/jsonrainbow/json-schema/pull/772))
3334

3435
## [6.0.0] - 2024-07-30
3536
### Added

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,6 @@ parameters:
335335
count: 1
336336
path: src/JsonSchema/Constraints/FormatConstraint.php
337337

338-
-
339-
message: "#^Strict comparison using \\=\\=\\= between null and non\\-falsy\\-string\\|false will always evaluate to false\\.$#"
340-
count: 1
341-
path: src/JsonSchema/Constraints/FormatConstraint.php
342-
343338
-
344339
message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
345340
count: 1

src/JsonSchema/Constraints/FormatConstraint.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,7 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $i =
133133
break;
134134

135135
case 'email':
136-
$filterFlags = FILTER_NULL_ON_FAILURE;
137-
if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
138-
// Only available from PHP >= 7.1.0, so ignore it for coverage checks
139-
$filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE'); // @codeCoverageIgnore
140-
}
141-
if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
136+
if (null === filter_var($element, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE | FILTER_FLAG_EMAIL_UNICODE)) {
142137
$this->addError(ConstraintError::FORMAT_EMAIL(), $path, ['format' => $schema->format]);
143138
}
144139
break;

0 commit comments

Comments
 (0)