Repository: symfony/symfony
File: src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php (PHP)

Code before:

            case self::ARRAY_CALL:
                $array = $this->nodes['node']->evaluate($functions, $values);

                if (null === $array && ($nullSafe || $this->isShortCircuited())) {
                    $this->attributes['is_short_circuited'] = $nullSafe || $this->attributes['is_short_circuited'];

                    return null;
                }

                if (!\is_array($array) && !$array instanceof \ArrayAccess && !(null === $array && $this->attributes['is_null_coalesce'])) {
                    throw new \RuntimeException(\sprintf('Unable to get an item of non-array "%s".', $this->nodes['node']->dump()));
                }

                if ($this->attributes['is_null_coalesce']) {
                    return $array[$this->nodes['attribute']->evaluate($functions, $values)] ?? null;
                }

                return $array[$this->nodes['attribute']->evaluate($functions, $values)];
        }
    }

    public static function convertToArrayAccess(mixed $value, string $nodeDump): ?\ArrayAccess
    {
        if (null === $value) {
            return null;
        }

        if (\is_array($value)) {
            return new \ArrayObject($value);
        }

        if ($value instanceof \ArrayAccess) {
            return $value;
        }

        throw new \RuntimeException(\sprintf('Unable to get an item of non-array "%s".', $nodeDump));
    }

    private function isShortCircuited(): bool
    {
        return $this->attributes['is_short_circuited'] || ($this->nodes['node'] instanceof self && $this->nodes['node']->isShortCircuited());
    }

    public function toArray(): array
    {
        $nullSafe = $this->nodes['attribute'] instanceof ConstantNode && $this->nodes['attribute']->isNullSafe;
        switch ($this->attributes['type']) {
            case self::PROPERTY_CALL:
                return [$this->nodes['node'], $nullSafe ? '?.' : '.', $this->nodes['attribute']];


Review comment (suggestion):
```suggestion
    /**
     * @internal
     */
    public static function convertToArrayAccess(mixed $value, string $nodeDump): ?\ArrayAccess
```

Code after:

            case self::ARRAY_CALL:
                $array = $this->nodes['node']->evaluate($functions, $values);

                if (null === $array && ($nullSafe || $this->isShortCircuited())) {
                    $this->attributes['is_short_circuited'] = $nullSafe || $this->attributes['is_short_circuited'];

                    return null;
                }

                if (!\is_array($array) && !$array instanceof \ArrayAccess && !(null === $array && $this->attributes['is_null_coalesce'])) {
                    throw new \RuntimeException(\sprintf('Unable to get an item of non-array "%s".', $this->nodes['node']->dump()));
                }

                if ($this->attributes['is_null_coalesce']) {
                    return $array[$this->nodes['attribute']->evaluate($functions, $values)] ?? null;
                }

                return $array[$this->nodes['attribute']->evaluate($functions, $values)];
        }
    }

    /**
     * @internal
     */
    public static function convertToArrayAccess(mixed $value, string $nodeDump): ?\ArrayAccess
    {
        if (null === $value) {
            return null;
        }

        if (\is_array($value)) {
            return new \ArrayObject($value);
        }

        if ($value instanceof \ArrayAccess) {
            return $value;
        }

        throw new \RuntimeException(\sprintf('Unable to get an item of non-array "%s".', $nodeDump));
    }

    private function isShortCircuited(): bool
    {
        return $this->attributes['is_short_circuited'] || ($this->nodes['node'] instanceof self && $this->nodes['node']->isShortCircuited());
    }

    public function toArray(): array
    {
        $nullSafe = $this->nodes['attribute'] instanceof ConstantNode && $this->nodes['attribute']->isNullSafe;
        switch ($this->attributes['type']) {