@@ -34,22 +34,15 @@ final class Exists implements BooleanType
3434 private ?WhereClause $ where ;
3535
3636 /**
37- * @var bool Whether to insert parentheses around the expression
38- */
39- private bool $ insertParentheses ;
40-
41- /**
42- * @param MatchClause $match The MATCH part of the EXISTS expression
43- * @param null|WhereClause $where The optional WHERE part of the EXISTS expression
44- * @param bool $insertParentheses Whether to insert parentheses around the expression
37+ * @param MatchClause $match The MATCH part of the EXISTS expression
38+ * @param null|WhereClause $where The optional WHERE part of the EXISTS expression
4539 *
4640 * @internal This function is not covered by the backwards compatibility guarantee of php-cypher-dsl
4741 */
48- public function __construct (MatchClause $ match , ?WhereClause $ where = null , bool $ insertParentheses = false )
42+ public function __construct (MatchClause $ match , ?WhereClause $ where = null )
4943 {
5044 $ this ->match = $ match ;
5145 $ this ->where = $ where ;
52- $ this ->insertParentheses = $ insertParentheses ;
5346 }
5447
5548 /**
@@ -68,27 +61,19 @@ public function getWhere(): ?WhereClause
6861 return $ this ->where ;
6962 }
7063
71- /**
72- * Returns whether it inserts parentheses around the expression.
73- */
74- public function insertsParentheses (): bool
75- {
76- return $ this ->insertParentheses ;
77- }
78-
7964 /**
8065 * @inheritDoc
8166 */
8267 public function toQuery (): string
8368 {
8469 if (isset ($ this ->where )) {
8570 return sprintf (
86- $ this -> insertParentheses ? " (EXISTS { %s %s }) " : "EXISTS { %s %s } " ,
71+ "EXISTS { %s %s } " ,
8772 $ this ->match ->toQuery (),
8873 $ this ->where ->toQuery ()
8974 );
9075 }
9176
92- return sprintf ($ this -> insertParentheses ? " (EXISTS { %s }) " : "EXISTS { %s } " , $ this ->match ->toQuery ());
77+ return sprintf ("EXISTS { %s } " , $ this ->match ->toQuery ());
9378 }
9479}
0 commit comments