From e41d4b3af6fc3666f367ce03c5051229dced1efd Mon Sep 17 00:00:00 2001 From: Dennis Fridrich Date: Fri, 24 Jul 2026 21:45:02 +0300 Subject: [PATCH] Allow Symfony 8 and fix PHP 8.4+ nullable deprecations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit symfony/finder was capped at ^7, which blocks installing the library in any Symfony 8 project. Widen it to ^8 (and var-dumper/phpunit for dev). Also declare the two implicitly-nullable parameters explicitly — PHP 8.4 deprecates `Type $x = null`: - CnbRates::getRates() - NameDaysAbstract::getNameDay() Tested on PHP 8.5.6 with symfony/finder 8.1.1: CnbRatesTest and NameDayTest pass. OpenWeatherTest still needs a WEATHER_API key and fails without one, unchanged by this PR. --- composer.json | 6 +++--- src/CnbRates.php | 2 +- src/NameDaysAbstract.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 137e453..958300d 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ ], "require": { "php": "^7.4|^8.0", - "symfony/finder": "^4|^5|^6|^7", + "symfony/finder": "^4|^5|^6|^7|^8", "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^9|^10", - "symfony/var-dumper": "^4|^5|^6|^7" + "phpunit/phpunit": "^9|^10|^11|^12|^13", + "symfony/var-dumper": "^4|^5|^6|^7|^8" }, "autoload": { "psr-4": { diff --git a/src/CnbRates.php b/src/CnbRates.php index c247935..7c5c938 100644 --- a/src/CnbRates.php +++ b/src/CnbRates.php @@ -39,7 +39,7 @@ public function __construct(?string $cacheDir = null) $this->cacheDir = $cacheDir.'/defr'; } - public function getRates(DateTime $date = null): Rates + public function getRates(?DateTime $date = null): Rates { if (null === $date) { $date = new DateTime(); diff --git a/src/NameDaysAbstract.php b/src/NameDaysAbstract.php index 177492c..cbb1678 100644 --- a/src/NameDaysAbstract.php +++ b/src/NameDaysAbstract.php @@ -28,7 +28,7 @@ abstract class NameDaysAbstract * * @return string */ - public static function getNameDay(\DateTime $date = null) + public static function getNameDay(?\DateTime $date = null) { if (!$date) { $date = new \DateTime();