| @@ 609-633 (lines=25) @@ | ||
| 606 | * @psalm-suppress PossiblyInvalidArgument |
|
| 607 | * @psalm-suppress InvalidScalarArgument |
|
| 608 | */ |
|
| 609 | if ( |
|
| 610 | $this->pathSeparator |
|
| 611 | && |
|
| 612 | (string) $offset === $offset |
|
| 613 | && |
|
| 614 | \strpos($offset, $this->pathSeparator) !== false |
|
| 615 | ) { |
|
| 616 | $explodedPath = \explode($this->pathSeparator, (string) $offset); |
|
| 617 | if ($explodedPath !== false) { |
|
| 618 | /** @var string $lastOffset - helper for phpstan */ |
|
| 619 | $lastOffset = \array_pop($explodedPath); |
|
| 620 | $containerPath = \implode($this->pathSeparator, $explodedPath); |
|
| 621 | ||
| 622 | /** |
|
| 623 | * @psalm-suppress MissingClosureReturnType |
|
| 624 | * @psalm-suppress MissingClosureParamType |
|
| 625 | */ |
|
| 626 | $this->callAtPath( |
|
| 627 | $containerPath, |
|
| 628 | static function ($container) use ($lastOffset, &$offsetExists) { |
|
| 629 | $offsetExists = \array_key_exists($lastOffset, $container); |
|
| 630 | } |
|
| 631 | ); |
|
| 632 | } |
|
| 633 | } |
|
| 634 | ||
| 635 | return $offsetExists; |
|
| 636 | } |
|
| @@ 706-733 (lines=28) @@ | ||
| 703 | * @psalm-suppress PossiblyInvalidArgument |
|
| 704 | * @psalm-suppress InvalidScalarArgument |
|
| 705 | */ |
|
| 706 | if ( |
|
| 707 | $this->pathSeparator |
|
| 708 | && |
|
| 709 | (string) $offset === $offset |
|
| 710 | && |
|
| 711 | \strpos($offset, $this->pathSeparator) !== false |
|
| 712 | ) { |
|
| 713 | $path = \explode($this->pathSeparator, (string) $offset); |
|
| 714 | ||
| 715 | if ($path !== false) { |
|
| 716 | $pathToUnset = \array_pop($path); |
|
| 717 | ||
| 718 | /** |
|
| 719 | * @psalm-suppress MissingClosureReturnType |
|
| 720 | * @psalm-suppress MissingClosureParamType |
|
| 721 | */ |
|
| 722 | $this->callAtPath( |
|
| 723 | \implode($this->pathSeparator, $path), |
|
| 724 | static function (&$offset) use ($pathToUnset) { |
|
| 725 | if (\is_array($offset)) { |
|
| 726 | unset($offset[$pathToUnset]); |
|
| 727 | } else { |
|
| 728 | $offset = null; |
|
| 729 | } |
|
| 730 | } |
|
| 731 | ); |
|
| 732 | } |
|
| 733 | } |
|
| 734 | ||
| 735 | unset($this->array[$offset]); |
|
| 736 | } |
|