| @@ 691-715 (lines=25) @@ | ||
| 688 | * @psalm-suppress PossiblyInvalidArgument |
|
| 689 | * @psalm-suppress InvalidScalarArgument |
|
| 690 | */ |
|
| 691 | if ( |
|
| 692 | $this->pathSeparator |
|
| 693 | && |
|
| 694 | (string) $offset === $offset |
|
| 695 | && |
|
| 696 | \strpos($offset, $this->pathSeparator) !== false |
|
| 697 | ) { |
|
| 698 | $explodedPath = \explode($this->pathSeparator, (string) $offset); |
|
| 699 | if ($explodedPath !== false) { |
|
| 700 | /** @var string $lastOffset - helper for phpstan */ |
|
| 701 | $lastOffset = \array_pop($explodedPath); |
|
| 702 | $containerPath = \implode($this->pathSeparator, $explodedPath); |
|
| 703 | ||
| 704 | /** |
|
| 705 | * @psalm-suppress MissingClosureReturnType |
|
| 706 | * @psalm-suppress MissingClosureParamType |
|
| 707 | */ |
|
| 708 | $this->callAtPath( |
|
| 709 | $containerPath, |
|
| 710 | static function ($container) use ($lastOffset, &$offsetExists) { |
|
| 711 | $offsetExists = \array_key_exists($lastOffset, $container); |
|
| 712 | } |
|
| 713 | ); |
|
| 714 | } |
|
| 715 | } |
|
| 716 | ||
| 717 | return $offsetExists; |
|
| 718 | } |
|
| @@ 795-822 (lines=28) @@ | ||
| 792 | * @psalm-suppress PossiblyInvalidArgument |
|
| 793 | * @psalm-suppress InvalidScalarArgument |
|
| 794 | */ |
|
| 795 | if ( |
|
| 796 | $this->pathSeparator |
|
| 797 | && |
|
| 798 | (string) $offset === $offset |
|
| 799 | && |
|
| 800 | \strpos($offset, $this->pathSeparator) !== false |
|
| 801 | ) { |
|
| 802 | $path = \explode($this->pathSeparator, (string) $offset); |
|
| 803 | ||
| 804 | if ($path !== false) { |
|
| 805 | $pathToUnset = \array_pop($path); |
|
| 806 | ||
| 807 | /** |
|
| 808 | * @psalm-suppress MissingClosureReturnType |
|
| 809 | * @psalm-suppress MissingClosureParamType |
|
| 810 | */ |
|
| 811 | $this->callAtPath( |
|
| 812 | \implode($this->pathSeparator, $path), |
|
| 813 | static function (&$offset) use ($pathToUnset) { |
|
| 814 | if (\is_array($offset)) { |
|
| 815 | unset($offset[$pathToUnset]); |
|
| 816 | } else { |
|
| 817 | $offset = null; |
|
| 818 | } |
|
| 819 | } |
|
| 820 | ); |
|
| 821 | } |
|
| 822 | } |
|
| 823 | ||
| 824 | unset($this->array[$offset]); |
|
| 825 | } |
|