From e99812ef6ffc4e7376615b38f931e86ec423a704 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Thu, 30 Jan 2020 14:02:02 +0100 Subject: [PATCH] Remove ExpressionBuilder::andX()/orX() --- UPGRADE.md | 4 +++ .../Query/Expression/ExpressionBuilder.php | 20 ------------ .../Expression/ExpressionBuilderTest.php | 32 ------------------- 3 files changed, 4 insertions(+), 52 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index a2b36c8aa7f..15444feef5d 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,9 @@ # Upgrade to 3.0 +## BC BREAK: Removed `ExpressionBuilder` methods + +The `andX()` and `orX()` methods of the `ExpressionBuilder` class have been removed. Use `and()` and `or()` instead. + ## BC BREAK: Removed `CompositeExpression` methods The `add()` and `addMultiple()` methods of the `CompositeExpression` class have been removed. Use `with()` instead, which returns a new instance. diff --git a/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php b/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php index bee7a681053..e4680eaf748 100644 --- a/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php +++ b/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php @@ -60,26 +60,6 @@ public function or($expression, ...$expressions) : CompositeExpression return new CompositeExpression(CompositeExpression::TYPE_OR, array_merge([$expression], $expressions)); } - /** - * @deprecated Use `and()` instead. - * - * @param string|CompositeExpression ...$expressions Requires at least one defined when converting to string. - */ - public function andX(...$expressions) : CompositeExpression - { - return new CompositeExpression(CompositeExpression::TYPE_AND, $expressions); - } - - /** - * @deprecated Use `or()` instead. - * - * @param string|CompositeExpression ...$expressions Requires at least one defined when converting to string. - */ - public function orX(...$expressions) : CompositeExpression - { - return new CompositeExpression(CompositeExpression::TYPE_OR, $expressions); - } - /** * Creates a comparison expression. * diff --git a/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php index 9026c0be457..09fd94aa712 100644 --- a/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php @@ -40,22 +40,6 @@ public function testAnd(array $parts, string $expected) : void self::assertEquals($expected, (string) $composite); } - /** - * @param string[]|CompositeExpression[] $parts - * - * @dataProvider provideDataForAnd - */ - public function testAndX(array $parts, string $expected) : void - { - $composite = $this->expr->andX(); - - foreach ($parts as $part) { - $composite = $composite->with($part); - } - - self::assertEquals($expected, (string) $composite); - } - /** * @return mixed[][] */ @@ -113,22 +97,6 @@ public function testOr(array $parts, string $expected) : void self::assertEquals($expected, (string) $composite); } - /** - * @param string[]|CompositeExpression[] $parts - * - * @dataProvider provideDataForOr - */ - public function testOrX(array $parts, string $expected) : void - { - $composite = $this->expr->orX(); - - foreach ($parts as $part) { - $composite = $composite->with($part); - } - - self::assertEquals($expected, (string) $composite); - } - /** * @return mixed[][] */