From 3d607d05389d22565ac7c81ada69da5b37e9502d Mon Sep 17 00:00:00 2001 From: wickedOne Date: Sun, 19 Jul 2020 17:57:26 +0200 Subject: [PATCH] style fixes --- src/Builder/Select/ExpressionBuilder.php | 7 +++++++ src/Builder/Select/QueryBuilder.php | 7 +++++++ src/Builder/Select/QueryExpressionVisitor.php | 11 +++++++++-- src/Component/QueryTrait.php | 6 +++--- src/QueryType/Select/Query/Query.php | 4 ++-- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/Builder/Select/ExpressionBuilder.php b/src/Builder/Select/ExpressionBuilder.php index d2f78edd6..f6cb84b65 100644 --- a/src/Builder/Select/ExpressionBuilder.php +++ b/src/Builder/Select/ExpressionBuilder.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of the Solarium package. + * + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + namespace Solarium\Builder\Select; use Solarium\Builder\Comparison; diff --git a/src/Builder/Select/QueryBuilder.php b/src/Builder/Select/QueryBuilder.php index c65aad3aa..3cf53915d 100644 --- a/src/Builder/Select/QueryBuilder.php +++ b/src/Builder/Select/QueryBuilder.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of the Solarium package. + * + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + namespace Solarium\Builder\Select; use Solarium\Builder\ExpressionInterface; diff --git a/src/Builder/Select/QueryExpressionVisitor.php b/src/Builder/Select/QueryExpressionVisitor.php index e3904b42d..8f5e2dcfb 100644 --- a/src/Builder/Select/QueryExpressionVisitor.php +++ b/src/Builder/Select/QueryExpressionVisitor.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of the Solarium package. + * + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + namespace Solarium\Builder\Select; use Solarium\Builder\AbstractExpressionVisitor; @@ -104,7 +111,7 @@ public function walkExpression(ExpressionInterface $expression) case Comparison::EMPTY: return sprintf('(*:* NOT %s:*)', $field); default: - throw new RuntimeException('Unknown comparison operator: '.$expression->getOperator()); + throw new RuntimeException(sprintf('Unknown comparison operator: %s', $expression->getOperator())); } } @@ -135,7 +142,7 @@ public function walkCompositeExpression(ExpressionInterface $expr) case CompositeComparison::TYPE_OR: return implode(' OR ', $comparisons); default: - throw new RuntimeException('Unknown composite '.$expr->getType()); + throw new RuntimeException(sprintf('Unknown composite %s', $expr->getType())); } } diff --git a/src/Component/QueryTrait.php b/src/Component/QueryTrait.php index 6f38d6ad8..1be135e02 100644 --- a/src/Component/QueryTrait.php +++ b/src/Component/QueryTrait.php @@ -41,13 +41,13 @@ public function setQuery(string $query, array $bind = null): QueryInterface /** * @param \Solarium\Builder\Select\QueryBuilder $builder * - * @return \Solarium\Component\QueryInterface - * * @throws \Solarium\Exception\RuntimeException + * + * @return \Solarium\Component\QueryInterface */ public function setQueryFromQueryBuilder(QueryBuilder $builder): QueryInterface { - if (1 !== count($builder->getExpressions())) { + if (1 !== \count($builder->getExpressions())) { throw new RuntimeException('The QueryBuilder can only contain one expression when setting the query. Use ExpressionBuilder::andX or ExpressionBuilder::orX to combine expressions.'); } diff --git a/src/QueryType/Select/Query/Query.php b/src/QueryType/Select/Query/Query.php index fb1a154df..589ab0436 100644 --- a/src/QueryType/Select/Query/Query.php +++ b/src/QueryType/Select/Query/Query.php @@ -598,9 +598,9 @@ public function addFilterQueries(array $filterQueries): self * * @param \Solarium\Builder\Select\QueryBuilder $builder * - * @return $this - * * @throws \Solarium\Exception\RuntimeException + * + * @return $this */ public function addFilterQueriesFromQueryBuilder(QueryBuilder $builder): self {