From b21cade6d4bcfcd84ba507ec9d039425cdb94583 Mon Sep 17 00:00:00 2001 From: Dominik Zogg Date: Wed, 28 Dec 2022 13:19:50 +0100 Subject: [PATCH] fix php 8.2 related issue --- composer.json | 2 +- src/Constraint/DateTimeConstraint.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d32360c..5ddf68b 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ "@test:cs" ], "test:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache", - "test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=91 --verbose --coverage=build/phpunit", + "test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=90 --verbose --coverage=build/phpunit", "test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-result-file=build/phpunit/result.cache", "test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log", "test:loc": "mkdir -p build && vendor/bin/phploc src | tee build/phploc.log", diff --git a/src/Constraint/DateTimeConstraint.php b/src/Constraint/DateTimeConstraint.php index 6589d64..b16d37a 100644 --- a/src/Constraint/DateTimeConstraint.php +++ b/src/Constraint/DateTimeConstraint.php @@ -48,6 +48,10 @@ public function validate( $dateTimeErrors = \DateTimeImmutable::getLastErrors(); + if (!$dateTimeErrors) { + return []; + } + return [...$this->errorsByDateTimeLastErrors( $path, $value,