Can you rewrite this block to:

```php
$resultVariable = $this->queryComponents[$groupByItem]['resultVariable'];

if ($resultVariable instanceof AST\PathExpression) {
    return $this->walkPathExpression($resultVariable);
}

if (isset($resultVariable->pathExpression)) {
    return $this->walkPathExpression($resultVariable->pathExpression);
}

return return $this->walkResultVariable($groupByItem);
```