mirror of
https://github.com/symfony/ux-map.git
synced 2026-03-23 23:42:07 +01:00
Ensure PHP 8.5 compatibility
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
## 2.30
|
||||
|
||||
- Ensure compatibility with PHP 8.5
|
||||
|
||||
## 2.30
|
||||
|
||||
- Deprecate option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle` in favor of `infoWindow`
|
||||
|
||||
## 2.29.0
|
||||
|
||||
@@ -27,18 +27,18 @@ abstract class Elements
|
||||
) {
|
||||
$this->elements = new \SplObjectStorage();
|
||||
foreach ($elements as $element) {
|
||||
$this->elements->attach($element);
|
||||
$this->add($element);
|
||||
}
|
||||
}
|
||||
|
||||
public function add(Element $element): static
|
||||
{
|
||||
$this->elements->attach($element, $element->id ?? $this->elements->getHash($element));
|
||||
$this->elements[$element] = $element->id ?? $this->elements->getHash($element);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getElement(string $id): ?Element
|
||||
private function getElementById(string $id): ?Element
|
||||
{
|
||||
foreach ($this->elements as $element) {
|
||||
if ($element->id === $id) {
|
||||
@@ -52,15 +52,13 @@ abstract class Elements
|
||||
public function remove(Element|string $elementOrId): static
|
||||
{
|
||||
if (\is_string($elementOrId)) {
|
||||
$elementOrId = $this->getElement($elementOrId);
|
||||
$element = $this->getElementById($elementOrId);
|
||||
} else {
|
||||
$element = $elementOrId;
|
||||
}
|
||||
|
||||
if (null === $elementOrId) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if ($this->elements->contains($elementOrId)) {
|
||||
$this->elements->detach($elementOrId);
|
||||
if (null !== $element && $this->elements->offsetExists($element)) {
|
||||
unset($this->elements[$element]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user