mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°8910 - Upgrade Symfony packages (#811)
This commit is contained in:
@@ -120,16 +120,11 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
|
||||
public function offsetSet(mixed $key, mixed $value): void
|
||||
{
|
||||
if (null === $key || !isset($this->elements[$key])) {
|
||||
if (null === $key) {
|
||||
$key = [] === $this->orderedKeys
|
||||
// If the array is empty, use 0 as key
|
||||
? 0
|
||||
// Imitate PHP behavior of generating a key that equals
|
||||
// the highest existing integer key + 1
|
||||
: 1 + (int) max($this->orderedKeys);
|
||||
}
|
||||
|
||||
if (null === $key) {
|
||||
$this->elements[] = $value;
|
||||
$key = array_key_last($this->elements);
|
||||
$this->orderedKeys[] = (string) $key;
|
||||
} elseif (!\array_key_exists($key, $this->elements)) {
|
||||
$this->orderedKeys[] = (string) $key;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user