diff --git a/src/Map/CHANGELOG.md b/src/Map/CHANGELOG.md index 2bef0bfac4..493b1c01b9 100644 --- a/src/Map/CHANGELOG.md +++ b/src/Map/CHANGELOG.md @@ -7,8 +7,7 @@ - Add `DistanceCalculatorInterface` interface and three implementations: `HaversineDistanceCalculator`, `SphericalCosineDistanceCalculator` and `VincentyDistanceCalculator`. - Add `CoordinateUtils` helper, to convert decimal coordinates (`43.2109`) in DMS (`56° 78' 90"`) - -- Add property `$id` to `Marker`, `Polygon` and `Polyline` constructors +- Add parameter `id` to `Marker`, `Polygon` and `Polyline` constructors - Add method `Map::removeMarker(string|Marker $markerOrId)` - Add method `Map::removePolygon(string|Polygon $polygonOrId)` - Add method `Map::removePolyline(string|Polyline $polylineOrId)` diff --git a/src/Map/src/Element.php b/src/Map/src/Element.php index e035f43a22..c7f752ea8e 100644 --- a/src/Map/src/Element.php +++ b/src/Map/src/Element.php @@ -11,6 +11,11 @@ namespace Symfony\UX\Map; +/** + * @author Sylvain Blondeau + * + * @internal + */ interface Element { } diff --git a/src/Map/src/Elements.php b/src/Map/src/Elements.php index 4030f6b038..6dee1939f1 100644 --- a/src/Map/src/Elements.php +++ b/src/Map/src/Elements.php @@ -15,10 +15,12 @@ * Represents a collection of map elements. * * @author Sylvain Blondeau + * + * @internal */ abstract class Elements { - protected \SplObjectStorage $elements; + private \SplObjectStorage $elements; public function __construct( array $elements, @@ -29,7 +31,7 @@ public function __construct( } } - public function add(Element $element): self + public function add(Element $element): static { $this->elements->attach($element, $element->id ?? $this->elements->getHash($element)); @@ -47,7 +49,7 @@ private function getElement(string $id): ?Element return null; } - public function remove(Element|string $elementOrId): self + public function remove(Element|string $elementOrId): static { if (\is_string($elementOrId)) { $elementOrId = $this->getElement($elementOrId); diff --git a/src/Map/src/Map.php b/src/Map/src/Map.php index b608303040..f0d49c60f0 100644 --- a/src/Map/src/Map.php +++ b/src/Map/src/Map.php @@ -26,8 +26,8 @@ final class Map /** * @param Marker[] $markers + * @param Polygon[] $polygons * @param Polyline[] $polylines - * @param Polygone[] $polygons */ public function __construct( private readonly ?string $rendererName = null, @@ -40,8 +40,8 @@ public function __construct( array $polylines = [], ) { $this->markers = new Markers($markers); - $this->polylines = new Polylines($polylines); $this->polygons = new Polygons($polygons); + $this->polylines = new Polylines($polylines); } public function getRendererName(): ?string diff --git a/src/Map/src/Markers.php b/src/Map/src/Markers.php index 405cc2654e..b82e3cf05a 100644 --- a/src/Map/src/Markers.php +++ b/src/Map/src/Markers.php @@ -15,6 +15,8 @@ * Represents a Marker collection. * * @author Sylvain Blondeau + * + * @internal */ final class Markers extends Elements { diff --git a/src/Map/src/Polygons.php b/src/Map/src/Polygons.php index 259e5d1348..5d75ba8f0c 100644 --- a/src/Map/src/Polygons.php +++ b/src/Map/src/Polygons.php @@ -15,6 +15,8 @@ * Represents a Polygon collection. * * @author Sylvain Blondeau + * + * @internal */ final class Polygons extends Elements { diff --git a/src/Map/src/Polylines.php b/src/Map/src/Polylines.php index 5359c12aa1..810f180d13 100644 --- a/src/Map/src/Polylines.php +++ b/src/Map/src/Polylines.php @@ -15,6 +15,8 @@ * Represents a Polyline collection. * * @author Sylvain Blondeau + * + * @internal */ final class Polylines extends Elements {