Add support for detecting if an expression had explicit parentheses

This commit is contained in:
Fabien Potencier
2024-09-30 11:52:45 +02:00
parent 4e08e3ef5f
commit d133ab7e70
3 changed files with 19 additions and 9 deletions
@@ -25,4 +25,19 @@ abstract class AbstractExpression extends Node
{
return $this->hasAttribute('is_generator') && $this->getAttribute('is_generator');
}
/**
* @return static
*/
public function setExplicitParentheses(): self
{
$this->setAttribute('with_parentheses', true);
return $this;
}
public function hasExplicitParentheses(): bool
{
return $this->hasAttribute('with_parentheses') && $this->getAttribute('with_parentheses');
}
}