From 1f9226a6d95a7e3b050aae58ac3821377e0a1ded Mon Sep 17 00:00:00 2001 From: Oleg Zhulnev Date: Sat, 27 Jul 2024 15:29:32 +0300 Subject: [PATCH] update PHP-CS-Fixer to the latest version and enable parallelization in order to speedup builds --- .github/workflows/continuous-integration.yaml | 4 +-- .php-cs-fixer.dist.php | 5 +++ Makefile | 4 +-- phive.xml | 2 +- src/Aggregation/AbstractSimpleAggregation.php | 6 ++-- src/Aggregation/ReverseNested.php | 3 -- src/Aggregation/Traits/MissingTrait.php | 2 -- src/Aggregation/WeightedAvg.php | 6 ++-- src/Bulk/Action/DeleteDocument.php | 3 -- src/Bulk/Action/IndexDocument.php | 6 ---- src/Bulk/Action/UpdateDocument.php | 6 ---- src/Bulk/ResponseSet.php | 15 -------- src/Client.php | 26 -------------- src/Cluster/Settings.php | 4 --- src/Document.php | 12 ------- src/Index.php | 9 ----- src/Multi/ResultSet.php | 34 ------------------- src/Param.php | 3 -- src/Processor/SetProcessor.php | 5 --- src/Query/AbstractGeoDistance.php | 3 -- src/Query/BoolQuery.php | 3 -- src/Query/CombinedFields.php | 2 -- src/Query/FunctionScore.php | 3 -- src/Query/GeoDistance.php | 4 ++- src/Query/GeoPolygon.php | 6 ---- src/Query/GeoShapePreIndexed.php | 3 -- src/Query/GeoShapeProvided.php | 3 -- src/Query/HasChild.php | 3 -- src/Query/HasParent.php | 3 -- src/Query/Ids.php | 3 -- src/Query/InnerHits.php | 3 -- src/Query/MatchPhrase.php | 5 --- src/Query/MatchQuery.php | 7 ---- src/Query/MoreLikeThis.php | 3 -- src/Query/MultiMatch.php | 2 -- src/Query/QueryString.php | 3 -- src/Query/Script.php | 3 -- src/Query/Simple.php | 3 -- src/QueryBuilder/DSL/Query.php | 2 +- src/QueryBuilder/Facade.php | 2 -- src/Result.php | 2 -- src/ResultSet.php | 6 ++-- src/ResultSet/ChainProcessor.php | 3 -- src/Script/AbstractScript.php | 3 -- src/Script/Script.php | 3 -- src/Script/ScriptId.php | 3 -- src/Search.php | 12 ++----- src/Suggest.php | 5 +-- src/Suggest/Phrase.php | 3 -- tests/Aggregation/TopHitsTest.php | 2 -- tests/BulkTest.php | 3 -- tests/ClientFunctionalTest.php | 3 -- tests/QueryTest.php | 2 -- tests/ResultSet/ProcessingBuilderTest.php | 5 +-- tests/Script/ScriptIdTest.php | 2 -- tests/Script/ScriptTest.php | 2 -- tests/UtilTest.php | 12 ------- 57 files changed, 27 insertions(+), 268 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 90e29896b8..b3e17bf3e3 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -14,11 +14,11 @@ jobs: php-version: '8.0' coverage: 'none' extensions: 'json, mbstring, tokenizer' - tools: 'composer-normalize:2.28.0, php-cs-fixer:3.13.2' + tools: 'composer-normalize:2.28.0, php-cs-fixer:3.59.3' - name: 'Check PHP code' run: | - php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no + php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no --show-progress=dots - name: 'Check composer.json' run: | diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 6c604d3a32..a93e335146 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,6 +8,7 @@ ; return (new PhpCsFixer\Config()) + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setFinder($finder) ->setRules([ '@PHP80Migration' => true, @@ -33,5 +34,9 @@ 'static_lambda' => true, 'ternary_to_null_coalescing' => true, 'visibility_required' => ['elements' => ['property', 'method', 'const']], + 'fully_qualified_strict_types' => [ + 'import_symbols' => true, + ], + 'string_implicit_backslashes' => false, ]) ; diff --git a/Makefile b/Makefile index 9d3e51d761..fe0de3ee99 100644 --- a/Makefile +++ b/Makefile @@ -37,11 +37,11 @@ install-tools: install-phpcs .PHONY: run-phpcs run-phpcs: install-phpcs - tools/php-cs-fixer.phar fix --diff --dry-run --allow-risky=yes -v + tools/php-cs-fixer.phar fix --diff --dry-run --allow-risky=yes -v --show-progress=dots .PHONY: fix-phpcs fix-phpcs: install-phpcs - tools/php-cs-fixer.phar fix --allow-risky=yes -v + tools/php-cs-fixer.phar fix --allow-risky=yes -v --show-progress=dots .PHONY: run-phpunit run-phpunit: composer-install diff --git a/phive.xml b/phive.xml index fbfcbebed6..4c3d8ac2c1 100644 --- a/phive.xml +++ b/phive.xml @@ -1,5 +1,5 @@ - + diff --git a/src/Aggregation/AbstractSimpleAggregation.php b/src/Aggregation/AbstractSimpleAggregation.php index 7168a70eb3..fca0bb36e8 100644 --- a/src/Aggregation/AbstractSimpleAggregation.php +++ b/src/Aggregation/AbstractSimpleAggregation.php @@ -5,6 +5,7 @@ namespace Elastica\Aggregation; use Elastica\Exception\InvalidException; +use Elastica\Script\AbstractScript; abstract class AbstractSimpleAggregation extends AbstractAggregation { @@ -23,7 +24,7 @@ public function setField(string $field): self /** * Set a script for this aggregation. * - * @param \Elastica\Script\AbstractScript|string $script + * @param AbstractScript|string $script * * @return $this */ @@ -32,9 +33,6 @@ public function setScript($script): self return $this->setParam('script', $script); } - /** - * {@inheritdoc} - */ public function toArray(): array { if (!$this->hasParam('field') && !$this->hasParam('script')) { diff --git a/src/Aggregation/ReverseNested.php b/src/Aggregation/ReverseNested.php index 7bf58bafdc..8d156361ab 100644 --- a/src/Aggregation/ReverseNested.php +++ b/src/Aggregation/ReverseNested.php @@ -34,9 +34,6 @@ public function setPath(string $path): self return $this->setParam('path', $path); } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/src/Aggregation/Traits/MissingTrait.php b/src/Aggregation/Traits/MissingTrait.php index 386d96291e..d37a1104ea 100644 --- a/src/Aggregation/Traits/MissingTrait.php +++ b/src/Aggregation/Traits/MissingTrait.php @@ -9,8 +9,6 @@ trait MissingTrait /** * Defines how documents that are missing a value should be treated. * - * @param mixed $missing - * * @return $this */ public function setMissing($missing): self diff --git a/src/Aggregation/WeightedAvg.php b/src/Aggregation/WeightedAvg.php index d3cf339d67..441377e043 100644 --- a/src/Aggregation/WeightedAvg.php +++ b/src/Aggregation/WeightedAvg.php @@ -16,7 +16,7 @@ class WeightedAvg extends AbstractAggregation /** * Set the value for this aggregation. * - * @param mixed $missing + * @param mixed|null $missing * * @return $this */ @@ -52,7 +52,7 @@ public function setValueScript(string $script) /** * Set the weight for this aggregation. * - * @param mixed $missing + * @param mixed|null $missing * * @return $this */ @@ -100,8 +100,6 @@ public function setFormat($format) /** * Set the value_type for this aggregation. * - * @param mixed $valueType - * * @return $this */ public function setValueType($valueType) diff --git a/src/Bulk/Action/DeleteDocument.php b/src/Bulk/Action/DeleteDocument.php index a41a037099..de8410e7b8 100644 --- a/src/Bulk/Action/DeleteDocument.php +++ b/src/Bulk/Action/DeleteDocument.php @@ -13,9 +13,6 @@ class DeleteDocument extends AbstractDocument */ protected $_opType = self::OP_TYPE_DELETE; - /** - * {@inheritdoc} - */ protected function _getMetadata(AbstractUpdateAction $action): array { return $action->getOptions([ diff --git a/src/Bulk/Action/IndexDocument.php b/src/Bulk/Action/IndexDocument.php index 0259d5c807..30bfa2c2c1 100644 --- a/src/Bulk/Action/IndexDocument.php +++ b/src/Bulk/Action/IndexDocument.php @@ -14,9 +14,6 @@ class IndexDocument extends AbstractDocument */ protected $_opType = self::OP_TYPE_INDEX; - /** - * {@inheritdoc} - */ public function setDocument(Document $document): AbstractDocument { parent::setDocument($document); @@ -26,9 +23,6 @@ public function setDocument(Document $document): AbstractDocument return $this; } - /** - * {@inheritdoc} - */ protected function _getMetadata(AbstractUpdateAction $action): array { return $action->getOptions([ diff --git a/src/Bulk/Action/UpdateDocument.php b/src/Bulk/Action/UpdateDocument.php index 394c744105..2bdb19152e 100644 --- a/src/Bulk/Action/UpdateDocument.php +++ b/src/Bulk/Action/UpdateDocument.php @@ -14,9 +14,6 @@ class UpdateDocument extends IndexDocument */ protected $_opType = self::OP_TYPE_UPDATE; - /** - * {@inheritdoc} - */ public function setDocument(Document $document): AbstractDocument { parent::setDocument($document); @@ -38,9 +35,6 @@ public function setDocument(Document $document): AbstractDocument return $this; } - /** - * {@inheritdoc} - */ public function setScript(AbstractScript $script): AbstractDocument { parent::setScript($script); diff --git a/src/Bulk/ResponseSet.php b/src/Bulk/ResponseSet.php index 15c4ecf063..c112b89ac9 100644 --- a/src/Bulk/ResponseSet.php +++ b/src/Bulk/ResponseSet.php @@ -93,41 +93,26 @@ public function current(): Response return $this->_bulkResponses[$this->key()]; } - /** - * {@inheritdoc} - */ public function next(): void { ++$this->_position; } - /** - * {@inheritdoc} - */ public function key(): int { return $this->_position; } - /** - * {@inheritdoc} - */ public function valid(): bool { return isset($this->_bulkResponses[$this->key()]); } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->_position = 0; } - /** - * {@inheritdoc} - */ public function count(): int { return \count($this->_bulkResponses); diff --git a/src/Client.php b/src/Client.php index 31236ebdd1..4ac51e51ad 100644 --- a/src/Client.php +++ b/src/Client.php @@ -68,41 +68,26 @@ public function __construct(string|array $config = [], ?LoggerInterface $logger $this->_transport = $this->_buildTransport($this->getConfig()); } - /** - * {@inheritdoc} - */ public function getLogger(): LoggerInterface { return $this->_logger; } - /** - * {@inheritdoc} - */ public function getTransport(): Transport { return $this->_transport; } - /** - * {@inheritdoc} - */ public function setAsync(bool $async): self { throw new \Exception('Not supported'); } - /** - * {@inheritdoc} - */ public function getAsync(): bool { throw new \Exception('Not supported'); } - /** - * {@inheritdoc} - */ public function setElasticMetaHeader(bool $active): self { $this->elasticMetaHeader = $active; @@ -110,25 +95,16 @@ public function setElasticMetaHeader(bool $active): self return $this; } - /** - * {@inheritdoc} - */ public function getElasticMetaHeader(): bool { return $this->elasticMetaHeader; } - /** - * {@inheritdoc} - */ public function setResponseException(bool $active): self { throw new \Exception('Not supported'); } - /** - * {@inheritdoc} - */ public function getResponseException(): bool { throw new \Exception('Not supported'); @@ -192,8 +168,6 @@ public function setConfigValue(string $key, $value): self /** * @param array|string $keys config key or path of config keys * @param mixed $default default value will be returned if key was not found - * - * @return mixed */ public function getConfigValue($keys, $default = null) { diff --git a/src/Cluster/Settings.php b/src/Cluster/Settings.php index 5a8702ec11..ecac9156f0 100644 --- a/src/Cluster/Settings.php +++ b/src/Cluster/Settings.php @@ -103,8 +103,6 @@ public function getTransient(string $setting = '') /** * Sets persistent setting. - * - * @param mixed $value */ public function setPersistent(string $key, $value): Response { @@ -119,8 +117,6 @@ public function setPersistent(string $key, $value): Response /** * Sets transient settings. - * - * @param mixed $value */ public function setTransient(string $key, $value): Response { diff --git a/src/Document.php b/src/Document.php index 17f9bccd11..82a5ad28b1 100644 --- a/src/Document.php +++ b/src/Document.php @@ -49,17 +49,11 @@ public function __construct(?string $id = null, $data = [], $index = '') $this->setIndex($index); } - /** - * @return mixed - */ public function __get(string $key) { return $this->get($key); } - /** - * @param mixed $value - */ public function __set(string $key, $value): void { $this->set($key, $value); @@ -78,11 +72,7 @@ public function __unset(string $key): void /** * Get the value of the given field. * - * @param mixed $key - * * @throws InvalidException If the given field does not exist - * - * @return mixed */ public function get($key) { @@ -96,8 +86,6 @@ public function get($key) /** * Set the value of the given field. * - * @param mixed $value - * * @throws InvalidException if the current document is a serialized data */ public function set(string $key, $value): self diff --git a/src/Index.php b/src/Index.php index f5a91e8749..fc7584e3c0 100644 --- a/src/Index.php +++ b/src/Index.php @@ -518,9 +518,6 @@ public function exists(): bool return 200 === $response->getStatusCode(); } - /** - * {@inheritdoc} - */ public function createSearch($query = '', ?array $options = null, ?BuilderInterface $builder = null): Search { $search = new Search($this->getClient(), $builder); @@ -530,9 +527,6 @@ public function createSearch($query = '', ?array $options = null, ?BuilderInterf return $search; } - /** - * {@inheritdoc} - */ public function search($query = '', ?array $options = null, string $method = Request::POST): ResultSet { $search = $this->createSearch($query, $options); @@ -540,9 +534,6 @@ public function search($query = '', ?array $options = null, string $method = Req return $search->search('', null, $method); } - /** - * {@inheritdoc} - */ public function count($query = '', string $method = Request::POST): int { $search = $this->createSearch($query); diff --git a/src/Multi/ResultSet.php b/src/Multi/ResultSet.php index c3225c1229..e8f9766f2d 100644 --- a/src/Multi/ResultSet.php +++ b/src/Multi/ResultSet.php @@ -75,79 +75,48 @@ public function hasError(): bool return false; } - /** - * {@inheritdoc} - * - * @return mixed - */ #[\ReturnTypeWillChange] public function current() { return $this->_resultSets[$this->key()]; } - /** - * {@inheritdoc} - */ public function next(): void { ++$this->_position; } - /** - * {@inheritdoc} - */ public function key(): int { return $this->_position; } - /** - * {@inheritdoc} - */ public function valid(): bool { return isset($this->_resultSets[$this->key()]); } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->_position = 0; } - /** - * {@inheritdoc} - */ public function count(): int { return \count($this->_resultSets); } - /** - * {@inheritdoc} - */ public function offsetExists($offset): bool { return isset($this->_resultSets[$offset]); } - /** - * {@inheritdoc} - * - * @return mixed - */ #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->_resultSets[$offset] ?? null; } - /** - * {@inheritdoc} - */ public function offsetSet($offset, $value): void { if (null === $offset) { @@ -157,9 +126,6 @@ public function offsetSet($offset, $value): void } } - /** - * {@inheritdoc} - */ public function offsetUnset($offset): void { unset($this->_resultSets[$offset]); diff --git a/src/Param.php b/src/Param.php index 86cf202a85..e3414db1a6 100644 --- a/src/Param.php +++ b/src/Param.php @@ -138,8 +138,6 @@ public function getParams() } /** - * {@inheritdoc} - * * @return int */ #[\ReturnTypeWillChange] @@ -186,7 +184,6 @@ protected function _getBaseName() * Sets params not inside params array. * * @param string $key - * @param mixed $value * * @return $this */ diff --git a/src/Processor/SetProcessor.php b/src/Processor/SetProcessor.php index 1c2044bd73..7e5e44570f 100644 --- a/src/Processor/SetProcessor.php +++ b/src/Processor/SetProcessor.php @@ -18,9 +18,6 @@ class SetProcessor extends AbstractProcessor public const DEFAULT_OVERRIDE_VALUE = true; - /** - * @param mixed $value - */ public function __construct(string $field, $value) { $this->setField($field); @@ -30,8 +27,6 @@ public function __construct(string $field, $value) /** * Set field value. * - * @param mixed $value - * * @return $this */ public function setValue($value): self diff --git a/src/Query/AbstractGeoDistance.php b/src/Query/AbstractGeoDistance.php index 627610c5d2..faaa9e3893 100644 --- a/src/Query/AbstractGeoDistance.php +++ b/src/Query/AbstractGeoDistance.php @@ -145,9 +145,6 @@ public function setGeohash(string $geohash): self return $this; } - /** - * {@inheritdoc} - */ public function toArray(): array { $this->setParam($this->_key, $this->_getLocationData()); diff --git a/src/Query/BoolQuery.php b/src/Query/BoolQuery.php index 30fb549baa..89a8325f80 100644 --- a/src/Query/BoolQuery.php +++ b/src/Query/BoolQuery.php @@ -85,9 +85,6 @@ public function setMinimumShouldMatch($minimum): self return $this->setParam('minimum_should_match', $minimum); } - /** - * {@inheritdoc} - */ public function toArray(): array { if (!$this->_params) { diff --git a/src/Query/CombinedFields.php b/src/Query/CombinedFields.php index bb0a759121..9cf0b3ca1e 100644 --- a/src/Query/CombinedFields.php +++ b/src/Query/CombinedFields.php @@ -56,8 +56,6 @@ public function setOperator(string $operator = self::OPERATOR_OR): self /** * Set field minimum should match for Match Query. * - * @param mixed $minimumShouldMatch - * * @return $this */ public function setMinimumShouldMatch($minimumShouldMatch): self diff --git a/src/Query/FunctionScore.php b/src/Query/FunctionScore.php index 71d939aa9c..922bd41fa2 100644 --- a/src/Query/FunctionScore.php +++ b/src/Query/FunctionScore.php @@ -294,9 +294,6 @@ public function setMinScore(float $minScore): self return $this->setParam('min_score', $minScore); } - /** - * {@inheritdoc} - */ public function toArray(): array { if (0 < \count($this->_functions)) { diff --git a/src/Query/GeoDistance.php b/src/Query/GeoDistance.php index a3917f9338..c3ac49efcf 100644 --- a/src/Query/GeoDistance.php +++ b/src/Query/GeoDistance.php @@ -4,6 +4,8 @@ namespace Elastica\Query; +use Elastica\Exception\InvalidException; + /** * Geo distance query. * @@ -23,7 +25,7 @@ class GeoDistance extends AbstractGeoDistance * @param array|string $location Location as array or geohash: array('lat' => 48.86, 'lon' => 2.35) OR 'drm3btev3e86' * @param string $distance Distance * - * @throws \Elastica\Exception\InvalidException + * @throws InvalidException */ public function __construct(string $key, $location, string $distance) { diff --git a/src/Query/GeoPolygon.php b/src/Query/GeoPolygon.php index 583f58aed5..dff43e8199 100644 --- a/src/Query/GeoPolygon.php +++ b/src/Query/GeoPolygon.php @@ -39,9 +39,6 @@ public function __construct(string $key, array $points) $this->_points = $points; } - /** - * {@inheritdoc} - */ public function toArray(): array { return [ @@ -53,9 +50,6 @@ public function toArray(): array ]; } - /** - * {@inheritdoc} - */ public function count(): int { return \count($this->_points); diff --git a/src/Query/GeoShapePreIndexed.php b/src/Query/GeoShapePreIndexed.php index 328f3c9e64..dc5798dd2a 100644 --- a/src/Query/GeoShapePreIndexed.php +++ b/src/Query/GeoShapePreIndexed.php @@ -56,9 +56,6 @@ public function __construct( $this->_indexedPath = $indexedPath; } - /** - * {@inheritdoc} - */ public function toArray(): array { return [ diff --git a/src/Query/GeoShapeProvided.php b/src/Query/GeoShapeProvided.php index 7bcf6aceb2..36c17e623d 100644 --- a/src/Query/GeoShapeProvided.php +++ b/src/Query/GeoShapeProvided.php @@ -52,9 +52,6 @@ public function __construct(string $path, array $coordinates, string $shapeType $this->_coordinates = $coordinates; } - /** - * {@inheritdoc} - */ public function toArray(): array { return [ diff --git a/src/Query/HasChild.php b/src/Query/HasChild.php index cdbeaa5b92..5c95f253fa 100644 --- a/src/Query/HasChild.php +++ b/src/Query/HasChild.php @@ -78,9 +78,6 @@ public function setInnerHits(InnerHits $innerHits): self return $this->setParam('inner_hits', $innerHits); } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/src/Query/HasParent.php b/src/Query/HasParent.php index be14a818a2..7353ffe683 100644 --- a/src/Query/HasParent.php +++ b/src/Query/HasParent.php @@ -66,9 +66,6 @@ public function setScope(string $scope): self return $this->setParam('_scope', $scope); } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/src/Query/Ids.php b/src/Query/Ids.php index 3353262432..2911f1d3a0 100644 --- a/src/Query/Ids.php +++ b/src/Query/Ids.php @@ -57,9 +57,6 @@ public function setIds($ids): self return $this; } - /** - * {@inheritdoc} - */ public function toArray(): array { return ['ids' => $this->_params]; diff --git a/src/Query/InnerHits.php b/src/Query/InnerHits.php index c03ae7a904..58c3e3d9ce 100644 --- a/src/Query/InnerHits.php +++ b/src/Query/InnerHits.php @@ -16,9 +16,6 @@ */ class InnerHits extends AbstractQuery { - /** - * {@inheritdoc} - */ public function toArray() { $array = parent::toArray(); diff --git a/src/Query/MatchPhrase.php b/src/Query/MatchPhrase.php index 922f93b201..b5673438ed 100644 --- a/src/Query/MatchPhrase.php +++ b/src/Query/MatchPhrase.php @@ -14,9 +14,6 @@ */ class MatchPhrase extends AbstractQuery { - /** - * @param mixed $values - */ public function __construct(?string $field = null, $values = null) { if (null !== $field && null !== $values) { @@ -27,8 +24,6 @@ public function __construct(?string $field = null, $values = null) /** * Sets a param for the message array. * - * @param mixed $values - * * @return $this */ public function setField(string $field, $values): self diff --git a/src/Query/MatchQuery.php b/src/Query/MatchQuery.php index 23ba6e6726..f49337fc96 100644 --- a/src/Query/MatchQuery.php +++ b/src/Query/MatchQuery.php @@ -22,9 +22,6 @@ class MatchQuery extends AbstractQuery public const FUZZINESS_AUTO = 'AUTO'; - /** - * @param mixed $values - */ public function __construct(?string $field = null, $values = null) { if (null !== $field && null !== $values) { @@ -35,8 +32,6 @@ public function __construct(?string $field = null, $values = null) /** * Sets a param for the message array. * - * @param mixed $values - * * @return $this */ public function setField(string $field, $values): self @@ -121,8 +116,6 @@ public function setFieldMinimumShouldMatch(string $field, $minimumShouldMatch): /** * Set field fuzziness. * - * @param mixed $fuzziness - * * @return $this */ public function setFieldFuzziness(string $field, $fuzziness): self diff --git a/src/Query/MoreLikeThis.php b/src/Query/MoreLikeThis.php index c0bc5be965..e6bd8bc982 100644 --- a/src/Query/MoreLikeThis.php +++ b/src/Query/MoreLikeThis.php @@ -157,9 +157,6 @@ public function setMinimumShouldMatch($minimumShouldMatch = '30%'): self return $this->setParam('minimum_should_match', $minimumShouldMatch); } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/src/Query/MultiMatch.php b/src/Query/MultiMatch.php index 24f86e77e9..7b5f033bcc 100644 --- a/src/Query/MultiMatch.php +++ b/src/Query/MultiMatch.php @@ -93,8 +93,6 @@ public function setOperator(string $operator = self::OPERATOR_OR): self /** * Set field minimum should match for Match Query. * - * @param mixed $minimumShouldMatch - * * @return $this */ public function setMinimumShouldMatch($minimumShouldMatch): self diff --git a/src/Query/QueryString.php b/src/Query/QueryString.php index 9e25480d58..6ff5c48ce5 100644 --- a/src/Query/QueryString.php +++ b/src/Query/QueryString.php @@ -225,9 +225,6 @@ public function setTimezone(string $timezone): self return $this->setParam('time_zone', $timezone); } - /** - * {@inheritdoc} - */ public function toArray(): array { return ['query_string' => \array_merge(['query' => $this->_queryString], $this->getParams())]; diff --git a/src/Query/Script.php b/src/Query/Script.php index 08ea4ef765..91f2ca1a0f 100644 --- a/src/Query/Script.php +++ b/src/Query/Script.php @@ -40,9 +40,6 @@ public function setScript($script): self return $this->setParam('script', BaseScript::create($script)); } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/src/Query/Simple.php b/src/Query/Simple.php index b5d298ba8a..effea95c85 100644 --- a/src/Query/Simple.php +++ b/src/Query/Simple.php @@ -38,9 +38,6 @@ public function setQuery(array $query): self return $this; } - /** - * {@inheritdoc} - */ public function toArray(): array { return $this->_query; diff --git a/src/QueryBuilder/DSL/Query.php b/src/QueryBuilder/DSL/Query.php index 90c9c598b2..741ddd9974 100644 --- a/src/QueryBuilder/DSL/Query.php +++ b/src/QueryBuilder/DSL/Query.php @@ -73,7 +73,7 @@ public function getType(): string * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html * - * @param mixed $values + * @param mixed|null $values */ public function match(?string $field = null, $values = null): MatchQuery { diff --git a/src/QueryBuilder/Facade.php b/src/QueryBuilder/Facade.php index cf27a8302e..c86e8a950b 100644 --- a/src/QueryBuilder/Facade.php +++ b/src/QueryBuilder/Facade.php @@ -36,8 +36,6 @@ public function __construct(DSL $dsl, Version $version) * Executes DSL methods. * * @throws QueryBuilderException - * - * @return mixed */ public function __call(string $name, array $arguments) { diff --git a/src/Result.php b/src/Result.php index 511e8c990f..c2906e2d54 100644 --- a/src/Result.php +++ b/src/Result.php @@ -234,8 +234,6 @@ public function getDocument(): Document /** * Sets a parameter on the hit. - * - * @param mixed $value */ public function setParam(string $param, $value): void { diff --git a/src/ResultSet.php b/src/ResultSet.php index a04f58c54e..eb5ac448d7 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -126,7 +126,7 @@ public function getAggregations(): array * * @param string $name the name of the desired aggregation * - * @throws Exception\InvalidException if an aggregation by the given name cannot be found + * @throws InvalidException if an aggregation by the given name cannot be found */ public function getAggregation(string $name): array { @@ -295,7 +295,7 @@ public function offsetExists($offset): bool * * @param int $offset * - * @throws Exception\InvalidException If offset doesn't exist + * @throws InvalidException If offset doesn't exist */ public function offsetGet($offset): Result { @@ -314,7 +314,7 @@ public function offsetGet($offset): Result * @param int $offset * @param Result $value * - * @throws Exception\InvalidException + * @throws InvalidException */ public function offsetSet($offset, $value): void { diff --git a/src/ResultSet/ChainProcessor.php b/src/ResultSet/ChainProcessor.php index 352f92af95..d555dc386f 100644 --- a/src/ResultSet/ChainProcessor.php +++ b/src/ResultSet/ChainProcessor.php @@ -25,9 +25,6 @@ public function __construct(array $processors) $this->processors = $processors; } - /** - * {@inheritdoc} - */ public function process(ResultSet $resultSet): void { foreach ($this->processors as $processor) { diff --git a/src/Script/AbstractScript.php b/src/Script/AbstractScript.php index 1941059839..23b68a28cb 100644 --- a/src/Script/AbstractScript.php +++ b/src/Script/AbstractScript.php @@ -93,9 +93,6 @@ public function getLang(): ?string return $this->_lang; } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = $this->getScriptTypeArray(); diff --git a/src/Script/Script.php b/src/Script/Script.php index 48ee7d0568..ee6bf2f3fd 100644 --- a/src/Script/Script.php +++ b/src/Script/Script.php @@ -43,9 +43,6 @@ public function getScript(): string return $this->_scriptCode; } - /** - * {@inheritdoc} - */ protected function getScriptTypeArray(): array { return ['source' => $this->_scriptCode]; diff --git a/src/Script/ScriptId.php b/src/Script/ScriptId.php index 6a38130fd1..7c88c5045f 100644 --- a/src/Script/ScriptId.php +++ b/src/Script/ScriptId.php @@ -41,9 +41,6 @@ public function getScriptId(): string return $this->_scriptId; } - /** - * {@inheritdoc} - */ protected function getScriptTypeArray(): array { return ['id' => $this->_scriptId]; diff --git a/src/Search.php b/src/Search.php index 4294d7388b..03911aea58 100644 --- a/src/Search.php +++ b/src/Search.php @@ -148,9 +148,6 @@ public function setQuery($query): self return $this; } - /** - * @param mixed $value - */ public function setOption(string $key, $value): self { $this->validateOption($key); @@ -178,9 +175,6 @@ public function clearOptions(): self return $this; } - /** - * @param mixed $value - */ public function addOption(string $key, $value): self { $this->validateOption($key); @@ -197,8 +191,6 @@ public function hasOption(string $key): bool /** * @throws InvalidException if the given key does not exists as an option - * - * @return mixed */ public function getOption(string $key) { @@ -319,8 +311,8 @@ public function search($query = '', ?array $options = null, string $method = Req } /** - * @param array|Query|Query\AbstractQuery|string $query - * @param bool $fullResult By default only the total hit count is returned. If set to true, the full ResultSet including aggregations is returned + * @param AbstractQuery|array|Query|string $query + * @param bool $fullResult By default only the total hit count is returned. If set to true, the full ResultSet including aggregations is returned * * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx diff --git a/src/Suggest.php b/src/Suggest.php index 1fa1536d9d..77c091502d 100644 --- a/src/Suggest.php +++ b/src/Suggest.php @@ -40,7 +40,7 @@ public function addSuggestion(AbstractSuggest $suggestion): self /** * @param AbstractSuggest|Suggest $suggestion * - * @throws Exception\NotImplementedException + * @throws NotImplementedException */ public static function create($suggestion): self { @@ -51,9 +51,6 @@ public static function create($suggestion): self }; } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/src/Suggest/Phrase.php b/src/Suggest/Phrase.php index d280e22e32..2505c834b4 100644 --- a/src/Suggest/Phrase.php +++ b/src/Suggest/Phrase.php @@ -146,9 +146,6 @@ public function addDirectGenerator(DirectGenerator $generator): self return $this->addParam('candidate_generator', $generator); } - /** - * {@inheritdoc} - */ public function toArray(): array { $array = parent::toArray(); diff --git a/tests/Aggregation/TopHitsTest.php b/tests/Aggregation/TopHitsTest.php index 0cfe0e3126..8c79e65819 100644 --- a/tests/Aggregation/TopHitsTest.php +++ b/tests/Aggregation/TopHitsTest.php @@ -255,8 +255,6 @@ public function limitedSourceProvider(): array * @group functional * * @dataProvider limitedSourceProvider - * - * @param mixed $source */ public function testAggregateWithLimitedSource($source): void { diff --git a/tests/BulkTest.php b/tests/BulkTest.php index 982a1e0644..fa6e0cad4f 100644 --- a/tests/BulkTest.php +++ b/tests/BulkTest.php @@ -281,9 +281,6 @@ public function testAddRawData(): void * @group unit * * @dataProvider invalidRawDataProvider - * - * @param mixed $rawData - * @param mixed $failMessage */ public function testInvalidRawData($rawData, $failMessage): void { diff --git a/tests/ClientFunctionalTest.php b/tests/ClientFunctionalTest.php index e6815777ad..b779c8b468 100644 --- a/tests/ClientFunctionalTest.php +++ b/tests/ClientFunctionalTest.php @@ -885,9 +885,6 @@ public function testEndpointParamsRequest(): void /** * @dataProvider endpointQueryRequestDataProvider - * - * @param mixed $query - * @param mixed $totalHits */ public function testEndpointQueryRequest($query, $totalHits): void { diff --git a/tests/QueryTest.php b/tests/QueryTest.php index 6818e7c876..f257e36137 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -634,8 +634,6 @@ public function provideSetTrackTotalHitsInvalidValue(): iterable * @group functional * * @dataProvider provideSetTrackTotalHitsInvalidValue - * - * @param mixed $value */ public function testSetTrackTotalHitsInvalidValue($value): void { diff --git a/tests/ResultSet/ProcessingBuilderTest.php b/tests/ResultSet/ProcessingBuilderTest.php index fc44b16511..7e77237d39 100644 --- a/tests/ResultSet/ProcessingBuilderTest.php +++ b/tests/ResultSet/ProcessingBuilderTest.php @@ -11,6 +11,7 @@ use Elastica\ResultSet\ProcessingBuilder; use Elastica\ResultSet\ProcessorInterface; use Elastica\Test\Base as BaseTest; +use PHPUnit\Framework\MockObject\MockObject; /** * @group unit @@ -25,12 +26,12 @@ class ProcessingBuilderTest extends BaseTest private $builder; /** - * @var BuilderInterface|\PHPUnit\Framework\MockObject\MockObject + * @var BuilderInterface|MockObject */ private $innerBuilder; /** - * @var \PHPUnit\Framework\MockObject\MockObject|ProcessorInterface + * @var MockObject|ProcessorInterface */ private $processor; diff --git a/tests/Script/ScriptIdTest.php b/tests/Script/ScriptIdTest.php index 1f12ad011f..8e10f4e8f9 100644 --- a/tests/Script/ScriptIdTest.php +++ b/tests/Script/ScriptIdTest.php @@ -119,8 +119,6 @@ public function testCreateArray(): void * @group unit * * @dataProvider dataProviderCreateInvalid - * - * @param mixed $data */ public function testCreateInvalid($data): void { diff --git a/tests/Script/ScriptTest.php b/tests/Script/ScriptTest.php index b94efbe79d..38a9600c82 100644 --- a/tests/Script/ScriptTest.php +++ b/tests/Script/ScriptTest.php @@ -119,8 +119,6 @@ public function testCreateArray(): void * @group unit * * @dataProvider dataProviderCreateInvalid - * - * @param mixed $data */ public function testCreateInvalid($data): void { diff --git a/tests/UtilTest.php b/tests/UtilTest.php index a2e5c4f7a8..cd1f8a4837 100644 --- a/tests/UtilTest.php +++ b/tests/UtilTest.php @@ -16,9 +16,6 @@ class UtilTest extends BaseTest * @group unit * * @dataProvider getIsDateMathEscapedPairs - * - * @param mixed $requestUri - * @param mixed $expectedIsEscaped */ public function testIsDateMathEscaped($requestUri, $expectedIsEscaped): void { @@ -42,9 +39,6 @@ public function getIsDateMathEscapedPairs(): array * @group unit * * @dataProvider getEscapeDateMathPairs - * - * @param mixed $requestUri - * @param mixed $expectedEscapedRequestUri */ public function testEscapeDateMath($requestUri, $expectedEscapedRequestUri): void { @@ -77,9 +71,6 @@ public function getEscapeDateMathPairs(): array * @group unit * * @dataProvider getEscapeTermPairs - * - * @param mixed $unescaped - * @param mixed $escaped */ public function testEscapeTerm($unescaped, $escaped): void { @@ -102,9 +93,6 @@ public function getEscapeTermPairs(): array * @group unit * * @dataProvider getReplaceBooleanWordsPairs - * - * @param mixed $before - * @param mixed $after */ public function testReplaceBooleanWords($before, $after): void {