| @@ 708-732 (lines=25) @@ | ||
| 705 | * @psalm-suppress PossiblyInvalidArgument |
|
| 706 | * @psalm-suppress InvalidScalarArgument |
|
| 707 | */ |
|
| 708 | if ( |
|
| 709 | $this->pathSeparator |
|
| 710 | && |
|
| 711 | (string) $offset === $offset |
|
| 712 | && |
|
| 713 | \strpos($offset, $this->pathSeparator) !== false |
|
| 714 | ) { |
|
| 715 | $explodedPath = \explode($this->pathSeparator, (string) $offset); |
|
| 716 | if ($explodedPath !== false) { |
|
| 717 | /** @var string $lastOffset - helper for phpstan */ |
|
| 718 | $lastOffset = \array_pop($explodedPath); |
|
| 719 | $containerPath = \implode($this->pathSeparator, $explodedPath); |
|
| 720 | ||
| 721 | /** |
|
| 722 | * @psalm-suppress MissingClosureReturnType |
|
| 723 | * @psalm-suppress MissingClosureParamType |
|
| 724 | */ |
|
| 725 | $this->callAtPath( |
|
| 726 | $containerPath, |
|
| 727 | static function ($container) use ($lastOffset, &$offsetExists) { |
|
| 728 | $offsetExists = \array_key_exists($lastOffset, $container); |
|
| 729 | } |
|
| 730 | ); |
|
| 731 | } |
|
| 732 | } |
|
| 733 | ||
| 734 | return $offsetExists; |
|
| 735 | } |
|
| @@ 814-841 (lines=28) @@ | ||
| 811 | * @psalm-suppress PossiblyInvalidArgument |
|
| 812 | * @psalm-suppress InvalidScalarArgument |
|
| 813 | */ |
|
| 814 | if ( |
|
| 815 | $this->pathSeparator |
|
| 816 | && |
|
| 817 | (string) $offset === $offset |
|
| 818 | && |
|
| 819 | \strpos($offset, $this->pathSeparator) !== false |
|
| 820 | ) { |
|
| 821 | $path = \explode($this->pathSeparator, (string) $offset); |
|
| 822 | ||
| 823 | if ($path !== false) { |
|
| 824 | $pathToUnset = \array_pop($path); |
|
| 825 | ||
| 826 | /** |
|
| 827 | * @psalm-suppress MissingClosureReturnType |
|
| 828 | * @psalm-suppress MissingClosureParamType |
|
| 829 | */ |
|
| 830 | $this->callAtPath( |
|
| 831 | \implode($this->pathSeparator, $path), |
|
| 832 | static function (&$offset) use ($pathToUnset) { |
|
| 833 | if (\is_array($offset)) { |
|
| 834 | unset($offset[$pathToUnset]); |
|
| 835 | } else { |
|
| 836 | $offset = null; |
|
| 837 | } |
|
| 838 | } |
|
| 839 | ); |
|
| 840 | } |
|
| 841 | } |
|
| 842 | ||
| 843 | unset($this->array[$offset]); |
|
| 844 | } |
|