diff --git a/CHANGELOG.md b/CHANGELOG.md index b758368..dfb22e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.25 + +- Downgrade PHP requirement from 8.3 to 8.1 + ## 2.24 - Installing the package in a Symfony app using Flex won't add the `@symfony/ux-map` dependency to the `package.json` file anymore. @@ -26,13 +30,13 @@ ## 2.20 -- Deprecate `render_map` Twig function (will be removed in 2.21). Use +- Deprecate `render_map` Twig function (will be removed in 2.21). Use `ux_map` or the `` Twig component instead. -- Add `ux_map` Twig function (replaces `render_map` with a more flexible +- Add `ux_map` Twig function (replaces `render_map` with a more flexible interface) - Add `` Twig component - The importmap entry `@symfony/ux-map/abstract-map-controller` can be removed - from your importmap, it is no longer needed. + from your importmap, it is no longer needed. - Add `Polygon` support ## 2.19 diff --git a/composer.json b/composer.json index 509983e..c08fcb8 100644 --- a/composer.json +++ b/composer.json @@ -32,13 +32,13 @@ } }, "require": { - "php": ">=8.3", + "php": ">=8.1", "symfony/stimulus-bundle": "^2.18.1" }, "require-dev": { "symfony/asset-mapper": "^6.4|^7.0", "symfony/framework-bundle": "^6.4|^7.0", - "symfony/phpunit-bridge": "^6.4|^7.0", + "symfony/phpunit-bridge": "^7.2", "symfony/twig-bundle": "^6.4|^7.0", "symfony/ux-twig-component": "^2.18", "symfony/ux-icons": "^2.18" diff --git a/src/Distance/DistanceCalculator.php b/src/Distance/DistanceCalculator.php index 46e7193..43adfca 100644 --- a/src/Distance/DistanceCalculator.php +++ b/src/Distance/DistanceCalculator.php @@ -16,11 +16,11 @@ use Symfony\UX\Map\Point; /** * @author Simon André */ -final readonly class DistanceCalculator implements DistanceCalculatorInterface +final class DistanceCalculator implements DistanceCalculatorInterface { public function __construct( - private DistanceCalculatorInterface $calculator = new VincentyDistanceCalculator(), - private DistanceUnit $unit = DistanceUnit::Meter, + private readonly DistanceCalculatorInterface $calculator = new VincentyDistanceCalculator(), + private readonly DistanceUnit $unit = DistanceUnit::Meter, ) { } diff --git a/src/Distance/HaversineDistanceCalculator.php b/src/Distance/HaversineDistanceCalculator.php index 32b1868..f4a9fe0 100644 --- a/src/Distance/HaversineDistanceCalculator.php +++ b/src/Distance/HaversineDistanceCalculator.php @@ -20,7 +20,7 @@ use Symfony\UX\Map\Point; * * @author Simon André */ -final readonly class HaversineDistanceCalculator implements DistanceCalculatorInterface +final class HaversineDistanceCalculator implements DistanceCalculatorInterface { /** * @const float The Earth's radius in meters. diff --git a/src/Distance/SphericalCosineDistanceCalculator.php b/src/Distance/SphericalCosineDistanceCalculator.php index 7e5c1f6..f77716a 100644 --- a/src/Distance/SphericalCosineDistanceCalculator.php +++ b/src/Distance/SphericalCosineDistanceCalculator.php @@ -20,7 +20,7 @@ use Symfony\UX\Map\Point; * * @author Simon André */ -final readonly class SphericalCosineDistanceCalculator implements DistanceCalculatorInterface +final class SphericalCosineDistanceCalculator implements DistanceCalculatorInterface { /** * @const float The Earth's radius in meters. diff --git a/src/Distance/VincentyDistanceCalculator.php b/src/Distance/VincentyDistanceCalculator.php index 7a08184..db25a91 100644 --- a/src/Distance/VincentyDistanceCalculator.php +++ b/src/Distance/VincentyDistanceCalculator.php @@ -20,7 +20,7 @@ use Symfony\UX\Map\Point; * * @author Simon André */ -final readonly class VincentyDistanceCalculator implements DistanceCalculatorInterface +final class VincentyDistanceCalculator implements DistanceCalculatorInterface { /** * WS-84 ellipsoid parameters. diff --git a/src/Icon/UxIconRenderer.php b/src/Icon/UxIconRenderer.php index 1b99f4c..1e98120 100644 --- a/src/Icon/UxIconRenderer.php +++ b/src/Icon/UxIconRenderer.php @@ -18,10 +18,10 @@ use Symfony\UX\Icons\IconRendererInterface; * * @internal */ -readonly class UxIconRenderer +class UxIconRenderer { public function __construct( - private ?IconRendererInterface $renderer, + private readonly ?IconRendererInterface $renderer, ) { } diff --git a/src/InfoWindow.php b/src/InfoWindow.php index f3f1cb9..7f11365 100644 --- a/src/InfoWindow.php +++ b/src/InfoWindow.php @@ -16,19 +16,19 @@ namespace Symfony\UX\Map; * * @author Hugo Alliaume */ -final readonly class InfoWindow +final class InfoWindow { /** * @param array $extra Extra data, can be used by the developer to store additional information and * use them later JavaScript side */ public function __construct( - private ?string $headerContent = null, - private ?string $content = null, - private ?Point $position = null, - private bool $opened = false, - private bool $autoClose = true, - private array $extra = [], + private readonly ?string $headerContent = null, + private readonly ?string $content = null, + private readonly ?Point $position = null, + private readonly bool $opened = false, + private readonly bool $autoClose = true, + private readonly array $extra = [], ) { } diff --git a/src/MapOptionsNormalizer.php b/src/MapOptionsNormalizer.php index 8233c00..2186643 100644 --- a/src/MapOptionsNormalizer.php +++ b/src/MapOptionsNormalizer.php @@ -26,7 +26,10 @@ use Symfony\UX\Map\Exception\UnableToNormalizeOptionsException; */ final class MapOptionsNormalizer { - private const string KEY_PROVIDER = '@provider'; + /** + * @var string + */ + private const KEY_PROVIDER = '@provider'; /** * @var array> diff --git a/src/Marker.php b/src/Marker.php index 922bd06..ed58c48 100644 --- a/src/Marker.php +++ b/src/Marker.php @@ -20,19 +20,19 @@ use Symfony\UX\Map\Icon\IconType; * * @author Hugo Alliaume */ -final readonly class Marker implements Element +final class Marker implements Element { /** * @param array $extra Extra data, can be used by the developer to store additional information and * use them later JavaScript side */ public function __construct( - public Point $position, - public ?string $title = null, - public ?InfoWindow $infoWindow = null, - public array $extra = [], - public ?string $id = null, - public ?Icon $icon = null, + public readonly Point $position, + public readonly ?string $title = null, + public readonly ?InfoWindow $infoWindow = null, + public readonly array $extra = [], + public readonly ?string $id = null, + public readonly ?Icon $icon = null, ) { } diff --git a/src/Point.php b/src/Point.php index 864041e..283f95b 100644 --- a/src/Point.php +++ b/src/Point.php @@ -18,11 +18,11 @@ use Symfony\UX\Map\Exception\InvalidArgumentException; * * @author Hugo Alliaume */ -final readonly class Point +final class Point { public function __construct( - public float $latitude, - public float $longitude, + public readonly float $latitude, + public readonly float $longitude, ) { if ($latitude < -90 || $latitude > 90) { throw new InvalidArgumentException(\sprintf('Latitude must be between -90 and 90 degrees, "%s" given.', $latitude)); diff --git a/src/Polygon.php b/src/Polygon.php index 4faaf7e..1d526a1 100644 --- a/src/Polygon.php +++ b/src/Polygon.php @@ -18,17 +18,17 @@ use Symfony\UX\Map\Exception\InvalidArgumentException; * * @author [Pierre Svgnt] */ -final readonly class Polygon implements Element +final class Polygon implements Element { /** * @param array $extra Extra data, can be used by the developer to store additional information and use them later JavaScript side */ public function __construct( - private array $points, - private ?string $title = null, - private ?InfoWindow $infoWindow = null, - private array $extra = [], - public ?string $id = null, + private readonly array $points, + private readonly ?string $title = null, + private readonly ?InfoWindow $infoWindow = null, + private readonly array $extra = [], + public readonly ?string $id = null, ) { } diff --git a/src/Polyline.php b/src/Polyline.php index 15b1b77..9a51e62 100644 --- a/src/Polyline.php +++ b/src/Polyline.php @@ -18,17 +18,17 @@ use Symfony\UX\Map\Exception\InvalidArgumentException; * * @author [Sylvain Blondeau] */ -final readonly class Polyline implements Element +final class Polyline implements Element { /** * @param array $extra Extra data, can be used by the developer to store additional information and use them later JavaScript side */ public function __construct( - private array $points, - private ?string $title = null, - private ?InfoWindow $infoWindow = null, - private array $extra = [], - public ?string $id = null, + private readonly array $points, + private readonly ?string $title = null, + private readonly ?InfoWindow $infoWindow = null, + private readonly array $extra = [], + public readonly ?string $id = null, ) { } diff --git a/src/Renderer/AbstractRenderer.php b/src/Renderer/AbstractRenderer.php index 8b2ef9f..ad3ba43 100644 --- a/src/Renderer/AbstractRenderer.php +++ b/src/Renderer/AbstractRenderer.php @@ -20,11 +20,11 @@ use Symfony\UX\StimulusBundle\Helper\StimulusHelper; /** * @author Hugo Alliaume */ -abstract readonly class AbstractRenderer implements RendererInterface +abstract class AbstractRenderer implements RendererInterface { public function __construct( - private StimulusHelper $stimulus, - private UxIconRenderer $uxIconRenderer, + private readonly StimulusHelper $stimulus, + private readonly UxIconRenderer $uxIconRenderer, ) { } diff --git a/src/Renderer/Dsn.php b/src/Renderer/Dsn.php index ecac16d..adde1ab 100644 --- a/src/Renderer/Dsn.php +++ b/src/Renderer/Dsn.php @@ -16,13 +16,13 @@ use Symfony\UX\Map\Exception\InvalidArgumentException; /** * @author Hugo Alliaume */ -final readonly class Dsn +final class Dsn { - private string $scheme; - private string $host; - private ?string $user; - private array $options; - private string $originalDsn; + private readonly string $scheme; + private readonly string $host; + private readonly ?string $user; + private readonly array $options; + private readonly string $originalDsn; public function __construct(#[\SensitiveParameter] string $dsn) { diff --git a/src/Renderer/NullRenderer.php b/src/Renderer/NullRenderer.php index 76ab4a2..772a3d7 100644 --- a/src/Renderer/NullRenderer.php +++ b/src/Renderer/NullRenderer.php @@ -19,10 +19,10 @@ use Symfony\UX\Map\Map; * * @internal */ -final readonly class NullRenderer implements RendererInterface +final class NullRenderer implements RendererInterface { public function __construct( - private array $availableBridges = [], + private readonly array $availableBridges = [], ) { } diff --git a/src/Renderer/NullRendererFactory.php b/src/Renderer/NullRendererFactory.php index 0d2c28a..e27ccff 100644 --- a/src/Renderer/NullRendererFactory.php +++ b/src/Renderer/NullRendererFactory.php @@ -13,13 +13,13 @@ namespace Symfony\UX\Map\Renderer; use Symfony\UX\Map\Exception\UnsupportedSchemeException; -final readonly class NullRendererFactory implements RendererFactoryInterface +final class NullRendererFactory implements RendererFactoryInterface { /** * @param array $availableBridges */ public function __construct( - private array $availableBridges = [], + private readonly array $availableBridges = [], ) { } diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php index ca2da7f..6f230d6 100644 --- a/src/Renderer/Renderer.php +++ b/src/Renderer/Renderer.php @@ -18,13 +18,13 @@ use Symfony\UX\Map\Exception\UnsupportedSchemeException; * * @internal */ -final readonly class Renderer +final class Renderer { public function __construct( /** * @param iterable $factories */ - private iterable $factories, + private readonly iterable $factories, ) { } diff --git a/tests/DummyOptions.php b/tests/DummyOptions.php index f04acc9..04c1f8f 100644 --- a/tests/DummyOptions.php +++ b/tests/DummyOptions.php @@ -16,11 +16,11 @@ namespace Symfony\UX\Map\Tests; use Symfony\UX\Map\MapOptionsInterface; use Symfony\UX\Map\MapOptionsNormalizer; -final readonly class DummyOptions implements MapOptionsInterface +final class DummyOptions implements MapOptionsInterface { public function __construct( - private string $mapId, - private string $mapType, + private readonly string $mapId, + private readonly string $mapType, ) { } diff --git a/tests/Twig/MapExtensionTest.php b/tests/Twig/MapExtensionTest.php index e78e0ec..c9850f1 100644 --- a/tests/Twig/MapExtensionTest.php +++ b/tests/Twig/MapExtensionTest.php @@ -80,8 +80,9 @@ class MapExtensionTest extends KernelTestCase if (class_exists(DeprecatedCallableInfo::class)) { $this->expectDeprecation('Since symfony/ux-map 2.20: Twig Function "render_map" is deprecated; use "ux_map" instead in test at line 1.'); } else { - $this->expectDeprecation('Since symfony/ux-map 2.20: Twig Function "render_map" is deprecated. Use "ux_map" instead in test at line 1.'); + $this->expectDeprecation('Twig Function "render_map" is deprecated since version 2.20. Use "ux_map" instead in test at line 1.'); } + $html = $twig->render('test', ['map' => $map]); $this->assertSame('', $html); } @@ -103,7 +104,7 @@ class MapExtensionTest extends KernelTestCase self::getContainer()->set('test.ux_map.renderers', $renderer); $twig = self::getContainer()->get('twig'); - $template = $twig->createTemplate('{{ ux_map(center: {lat: 5, lng: 10}, zoom: 4, attributes: attributes) }}'); + $template = $twig->createTemplate('{{ ux_map(center={lat: 5, lng: 10}, zoom=4, attributes=attributes) }}'); $this->assertSame( '
',