diff --git a/src/Framework/Constraint/Connective.php b/src/Framework/Constraint/Connective.php index 94321d3f14a..6fcebbb1041 100644 --- a/src/Framework/Constraint/Connective.php +++ b/src/Framework/Constraint/Connective.php @@ -84,6 +84,14 @@ final protected function constraints(): array return $this->constraints; } + /** + * Returns true if the $constraint needs to be wrapped with braces. + */ + final protected function constraintNeedsParentheses(Constraint $constraint): bool + { + return $this->arity() > 1 && parent::constraintNeedsParentheses($constraint); + } + /** * Returns string representation of given operand in context of this operator * @@ -106,12 +114,4 @@ private function constraintToString(Constraint $constraint, int $position): stri return $prefix . ($string ?? $constraint->toString()); } - - /** - * Returns true if the $constraint needs to be wrapped with braces. - */ - final protected function constraintNeedsParentheses(Constraint $constraint): bool - { - return $this->arity() > 1 && parent::constraintNeedsParentheses($constraint); - } } diff --git a/tests/unit/Framework/Constraint/LogicalNotTest.php b/tests/unit/Framework/Constraint/LogicalNotTest.php index 244da32ebfd..5ce01c007f3 100644 --- a/tests/unit/Framework/Constraint/LogicalNotTest.php +++ b/tests/unit/Framework/Constraint/LogicalNotTest.php @@ -71,7 +71,6 @@ public function testLogicalNotOfLogicalOrToString(): void ]; $constraints = \array_map(static function (string $name): \NamedConstraint { - return \NamedConstraint::fromName($name); }, $names); @@ -104,7 +103,6 @@ public function testLogicalNotOfLogicalAndToString(): void ]; $constraints = \array_map(static function (string $name): \NamedConstraint { - return \NamedConstraint::fromName($name); }, $names);