| @@ 622-646 (lines=25) @@ | ||
| 619 | * @psalm-suppress PossiblyInvalidArgument |
|
| 620 | * @psalm-suppress InvalidScalarArgument |
|
| 621 | */ |
|
| 622 | if ( |
|
| 623 | $this->pathSeparator |
|
| 624 | && |
|
| 625 | (string) $offset === $offset |
|
| 626 | && |
|
| 627 | \strpos($offset, $this->pathSeparator) !== false |
|
| 628 | ) { |
|
| 629 | $explodedPath = \explode($this->pathSeparator, (string) $offset); |
|
| 630 | if ($explodedPath !== false) { |
|
| 631 | /** @var string $lastOffset - helper for phpstan */ |
|
| 632 | $lastOffset = \array_pop($explodedPath); |
|
| 633 | $containerPath = \implode($this->pathSeparator, $explodedPath); |
|
| 634 | ||
| 635 | /** |
|
| 636 | * @psalm-suppress MissingClosureReturnType |
|
| 637 | * @psalm-suppress MissingClosureParamType |
|
| 638 | */ |
|
| 639 | $this->callAtPath( |
|
| 640 | $containerPath, |
|
| 641 | static function ($container) use ($lastOffset, &$offsetExists) { |
|
| 642 | $offsetExists = \array_key_exists($lastOffset, $container); |
|
| 643 | } |
|
| 644 | ); |
|
| 645 | } |
|
| 646 | } |
|
| 647 | ||
| 648 | return $offsetExists; |
|
| 649 | } |
|
| @@ 719-746 (lines=28) @@ | ||
| 716 | * @psalm-suppress PossiblyInvalidArgument |
|
| 717 | * @psalm-suppress InvalidScalarArgument |
|
| 718 | */ |
|
| 719 | if ( |
|
| 720 | $this->pathSeparator |
|
| 721 | && |
|
| 722 | (string) $offset === $offset |
|
| 723 | && |
|
| 724 | \strpos($offset, $this->pathSeparator) !== false |
|
| 725 | ) { |
|
| 726 | $path = \explode($this->pathSeparator, (string) $offset); |
|
| 727 | ||
| 728 | if ($path !== false) { |
|
| 729 | $pathToUnset = \array_pop($path); |
|
| 730 | ||
| 731 | /** |
|
| 732 | * @psalm-suppress MissingClosureReturnType |
|
| 733 | * @psalm-suppress MissingClosureParamType |
|
| 734 | */ |
|
| 735 | $this->callAtPath( |
|
| 736 | \implode($this->pathSeparator, $path), |
|
| 737 | static function (&$offset) use ($pathToUnset) { |
|
| 738 | if (\is_array($offset)) { |
|
| 739 | unset($offset[$pathToUnset]); |
|
| 740 | } else { |
|
| 741 | $offset = null; |
|
| 742 | } |
|
| 743 | } |
|
| 744 | ); |
|
| 745 | } |
|
| 746 | } |
|
| 747 | ||
| 748 | unset($this->array[$offset]); |
|
| 749 | } |
|