Skip to content

Remove obsolete check if FILTER_FLAG_EMAIL_UNICODE is defined #772

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 3 commits into from
Jan 20, 2025
Merged
Changes from 1 commit
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
7 changes: 1 addition & 6 deletions src/JsonSchema/Constraints/FormatConstraint.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in src/JsonSchema/Constraints/FormatConstraint.php

View workflow job for this annotation

GitHub Actions / PHPStan

Ignored error pattern #^Strict comparison using \=\=\= between null and non\-falsy\-string\|false will always evaluate to false\.$# in path /home/runner/work/json-schema/json-schema/src/JsonSchema/Constraints/FormatConstraint.php was not matched in reported errors.

declare(strict_types=1);

Expand Down Expand Up @@ -133,12 +133,7 @@
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
Loading