diff --git a/CHANGELOG.md b/CHANGELOG.md index 3575abe7..31cf8963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.1] - 2026-09-29 + +### Fixed + +- Fix installation alongside `symfony/polyfill-deepclone`, the DeepClone extension version is now checked at runtime + instead of through a Composer conflict by @Brajk19 in https://github.com/sofascore/purgatory-bundle/pull/172 + ## [2.0.0] - 2026-09-29 ### Added @@ -148,6 +155,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Initial release +[2.0.1]: https://github.com/sofascore/purgatory-bundle/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/sofascore/purgatory-bundle/compare/v1.6.0...v2.0.0 [1.6.0]: https://github.com/sofascore/purgatory-bundle/compare/v1.5.0...v1.6.0 [1.5.0]: https://github.com/sofascore/purgatory-bundle/compare/v1.4.0...v1.5.0 diff --git a/composer.json b/composer.json index 7e4b926b..feb7c104 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,6 @@ "symfony/yaml": "To configure purge subscriptions using YAML files" }, "conflict": { - "ext-deepclone": "<0.7.1", "symfony/cache": "<6.4", "symfony/expression-language": "<6.4", "symfony/http-client": "<6.4", diff --git a/docs/README.md b/docs/README.md index 3425a77e..e323b257 100644 --- a/docs/README.md +++ b/docs/README.md @@ -464,7 +464,7 @@ composer require symfony/polyfill-deepclone ``` For better performance, you can instead install the [PHP extension](https://github.com/symfony/php-ext-deepclone) -with [PIE](https://github.com/php/pie): +(version 0.7.1 or higher) with [PIE](https://github.com/php/pie): ```sh pie install symfony/deepclone diff --git a/src/Attribute/PurgeOn.php b/src/Attribute/PurgeOn.php index 97871073..972e1026 100644 --- a/src/Attribute/PurgeOn.php +++ b/src/Attribute/PurgeOn.php @@ -41,8 +41,14 @@ public function __construct( string|array|null $route = null, string|array|Action|null $actions = null, ) { - if ($if instanceof \Closure && !\function_exists('deepclone_to_array')) { - throw new LogicException('You cannot use a closure for the "if" attribute because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); + if ($if instanceof \Closure) { + if (!\function_exists('deepclone_to_array')) { + throw new LogicException('You cannot use a closure for the "if" attribute because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); + } + + if (false !== ($version = phpversion('deepclone')) && version_compare($version, '0.7.1', '<')) { + throw new LogicException('You cannot use a closure for the "if" attribute because the DeepClone extension is too old. Upgrade it to 0.7.1 or higher.'); + } } $this->target = \is_array($target) || \is_string($target) ? new ForProperties($target) : $target; diff --git a/src/Attribute/RouteParamValue/DynamicValues.php b/src/Attribute/RouteParamValue/DynamicValues.php index f97cee2f..acb2c85d 100644 --- a/src/Attribute/RouteParamValue/DynamicValues.php +++ b/src/Attribute/RouteParamValue/DynamicValues.php @@ -48,6 +48,10 @@ private static function normalizeProvider(string|array|\Closure $provider): stri throw new LogicException('You cannot use a closure as a "DynamicValues" provider because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); } + if (false !== ($version = phpversion('deepclone')) && version_compare($version, '0.7.1', '<')) { + throw new LogicException('You cannot use a closure as a "DynamicValues" provider because the DeepClone extension is too old. Upgrade it to 0.7.1 or higher.'); + } + return $provider; }