From 1f31f717680845e380a5473d2248305a599ed280 Mon Sep 17 00:00:00 2001 From: Liakhovskyi Vladyslav Date: Thu, 29 Feb 2024 16:16:18 +0200 Subject: [PATCH] CS Fixer fixes with version 3.8.0. --- .../AbstractElasticaToModelTransformer.php | 4 ++-- src/Finder/PaginatedFinderInterface.php | 6 ++++++ src/Finder/TransformedFinder.php | 2 ++ src/Index/AliasProcessor.php | 4 ++-- src/Index/IndexTemplateManager.php | 4 ++-- src/Logger/ElasticaLogger.php | 2 ++ src/Paginator/RawPaginatorAdapter.php | 4 ++-- src/Persister/ObjectPersister.php | 4 ++-- src/Repository.php | 10 ++++++++++ .../ModelToElasticaAutoTransformer.php | 2 ++ tests/Functional/ProfilerTest.php | 2 ++ tests/Functional/WebTestCase.php | 2 ++ ...AbstractElasticaToModelTransformerTest.php | 20 +++++++++++++++++++ tests/Unit/Index/IndexTemplateManagerTest.php | 1 + tests/Unit/Logger/ElasticaLoggerTest.php | 2 ++ tests/Unit/Provider/IndexableTest.php | 5 +++++ 16 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/Doctrine/AbstractElasticaToModelTransformer.php b/src/Doctrine/AbstractElasticaToModelTransformer.php index 94ec58037..a2ab964fd 100644 --- a/src/Doctrine/AbstractElasticaToModelTransformer.php +++ b/src/Doctrine/AbstractElasticaToModelTransformer.php @@ -71,9 +71,9 @@ public function getObjectClass(): string * * @param Result[] $elasticaObjects of elastica objects * - * @return array - * * @throws \RuntimeException + * + * @return array */ public function transform(array $elasticaObjects) { diff --git a/src/Finder/PaginatedFinderInterface.php b/src/Finder/PaginatedFinderInterface.php index 85438f5fa..44c3518f1 100644 --- a/src/Finder/PaginatedFinderInterface.php +++ b/src/Finder/PaginatedFinderInterface.php @@ -45,6 +45,8 @@ public function findPaginated($query, array $options = []); * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return PaginatorAdapterInterface */ public function createPaginatorAdapter($query, array $options = []); @@ -55,6 +57,8 @@ public function createPaginatorAdapter($query, array $options = []); * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return PaginatorAdapterInterface */ public function createHybridPaginatorAdapter($query, array $options = []); @@ -65,6 +69,8 @@ public function createHybridPaginatorAdapter($query, array $options = []); * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return PaginatorAdapterInterface */ public function createRawPaginatorAdapter($query, array $options = []); diff --git a/src/Finder/TransformedFinder.php b/src/Finder/TransformedFinder.php index da4b53b8c..3294d597f 100644 --- a/src/Finder/TransformedFinder.php +++ b/src/Finder/TransformedFinder.php @@ -103,6 +103,8 @@ public function createRawPaginatorAdapter($query, array $options = []) * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return Result[] */ protected function search($query, ?int $limit = null, array $options = []) diff --git a/src/Index/AliasProcessor.php b/src/Index/AliasProcessor.php index 9f62e33bc..d8b2c74a3 100644 --- a/src/Index/AliasProcessor.php +++ b/src/Index/AliasProcessor.php @@ -42,9 +42,9 @@ public function setRootName(IndexConfig $indexConfig, Index $index) * * $force will delete an index encountered where an alias is expected. * - * @return void - * * @throws AliasIsIndexException + * + * @return void */ public function switchIndexAlias(IndexConfig $indexConfig, Index $index, bool $force = false, bool $delete = true) { diff --git a/src/Index/IndexTemplateManager.php b/src/Index/IndexTemplateManager.php index 75b7c5adc..2b442b47f 100644 --- a/src/Index/IndexTemplateManager.php +++ b/src/Index/IndexTemplateManager.php @@ -40,9 +40,9 @@ public function __construct(array $templates) * * @param string $name Index template to return * - * @return IndexTemplate - * * @throws \InvalidArgumentException if no index template exists for the given name + * + * @return IndexTemplate */ public function getIndexTemplate($name) { diff --git a/src/Logger/ElasticaLogger.php b/src/Logger/ElasticaLogger.php index c002fe6c7..e477d08e8 100644 --- a/src/Logger/ElasticaLogger.php +++ b/src/Logger/ElasticaLogger.php @@ -107,6 +107,8 @@ public function getQueries(): array /** * @param array $context + * @param mixed $level + * @param mixed $message */ public function log($level, $message, array $context = []): void { diff --git a/src/Paginator/RawPaginatorAdapter.php b/src/Paginator/RawPaginatorAdapter.php index a6e679775..05d8e86d7 100644 --- a/src/Paginator/RawPaginatorAdapter.php +++ b/src/Paginator/RawPaginatorAdapter.php @@ -142,9 +142,9 @@ public function getQuery() * @param int $offset * @param int $itemCountPerPage * - * @return ResultSet - * * @throws \InvalidArgumentException + * + * @return ResultSet */ protected function getElasticaResults($offset, $itemCountPerPage) { diff --git a/src/Persister/ObjectPersister.php b/src/Persister/ObjectPersister.php index ab7e4ebf7..8ef9edfb9 100644 --- a/src/Persister/ObjectPersister.php +++ b/src/Persister/ObjectPersister.php @@ -170,9 +170,9 @@ public function transformToElasticaDocument(object $object): Document /** * Log exception if logger defined for persister belonging to the current listener, otherwise re-throw. * - * @return void - * * @throws BulkException + * + * @return void */ private function log(BulkException $e) { diff --git a/src/Repository.php b/src/Repository.php index 2ae3f1bb1..479d885aa 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -36,6 +36,8 @@ public function __construct(PaginatedFinderInterface $finder) * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return array */ public function find($query, ?int $limit = null, array $options = []) @@ -47,6 +49,8 @@ public function find($query, ?int $limit = null, array $options = []) * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return list */ public function findHybrid($query, ?int $limit = null, array $options = []) @@ -58,6 +62,8 @@ public function findHybrid($query, ?int $limit = null, array $options = []) * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return \Pagerfanta\Pagerfanta */ public function findPaginated($query, array $options = []) @@ -69,6 +75,8 @@ public function findPaginated($query, array $options = []) * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return Paginator\PaginatorAdapterInterface */ public function createPaginatorAdapter($query, array $options = []) @@ -80,6 +88,8 @@ public function createPaginatorAdapter($query, array $options = []) * @phpstan-param TQuery $query * @phpstan-param TOptions $options * + * @param mixed $query + * * @return Paginator\PaginatorAdapterInterface */ public function createHybridPaginatorAdapter($query, array $options = []) diff --git a/src/Transformer/ModelToElasticaAutoTransformer.php b/src/Transformer/ModelToElasticaAutoTransformer.php index 49dcb7613..b804c5fd8 100644 --- a/src/Transformer/ModelToElasticaAutoTransformer.php +++ b/src/Transformer/ModelToElasticaAutoTransformer.php @@ -115,6 +115,8 @@ protected function transformNested($objects, array $fields): ?array /** * Attempts to convert any type to a string or an array of strings. * + * @param mixed $value + * * @return string|list */ protected function normalizeValue($value) diff --git a/tests/Functional/ProfilerTest.php b/tests/Functional/ProfilerTest.php index e1cfc5799..f0c69ea22 100644 --- a/tests/Functional/ProfilerTest.php +++ b/tests/Functional/ProfilerTest.php @@ -68,6 +68,8 @@ public function setUp(): void /** * @dataProvider queryProvider + * + * @param mixed $query */ public function testRender($query) { diff --git a/tests/Functional/WebTestCase.php b/tests/Functional/WebTestCase.php index 492a10787..88e41424b 100644 --- a/tests/Functional/WebTestCase.php +++ b/tests/Functional/WebTestCase.php @@ -74,6 +74,8 @@ protected static function getVarDir() /** * To be removed when dropping support of Symfony < 5.3. + * + * @param mixed $arguments */ public static function __callStatic(string $name, $arguments) { diff --git a/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php b/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php index cedc461a1..da4bf4f79 100644 --- a/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php +++ b/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php @@ -98,6 +98,9 @@ public function resultsWithMatchingObjects() /** * @dataProvider resultsWithMatchingObjects + * + * @param mixed $elasticaResults + * @param mixed $doctrineObjects */ public function testObjectsAreTransformedByFindingThemByTheirIdentifiers($elasticaResults, $doctrineObjects) { @@ -117,6 +120,9 @@ public function testObjectsAreTransformedByFindingThemByTheirIdentifiers($elasti /** * @dataProvider resultsWithMatchingObjects + * + * @param mixed $elasticaResults + * @param mixed $doctrineObjects */ public function testAnExceptionIsThrownWhenTheNumberOfFoundObjectsIsLessThanTheNumberOfResults( $elasticaResults, @@ -139,6 +145,9 @@ public function testAnExceptionIsThrownWhenTheNumberOfFoundObjectsIsLessThanTheN /** * @dataProvider resultsWithMatchingObjects + * + * @param mixed $elasticaResults + * @param mixed $doctrineObjects */ public function testAnExceptionIsNotThrownWhenTheNumberOfFoundObjectsIsLessThanTheNumberOfResultsIfOptionSet( $elasticaResults, @@ -160,6 +169,9 @@ public function testAnExceptionIsNotThrownWhenTheNumberOfFoundObjectsIsLessThanT /** * @dataProvider resultsWithMatchingObjects + * + * @param mixed $elasticaResults + * @param mixed $doctrineObjects */ public function testHighlightsAreSetOnTransformedObjects($elasticaResults, $doctrineObjects) { @@ -182,6 +194,9 @@ public function testHighlightsAreSetOnTransformedObjects($elasticaResults, $doct /** * @dataProvider resultsWithMatchingObjects + * + * @param mixed $elasticaResults + * @param mixed $doctrineObjects */ public function testResultsAreSortedByIdentifier($elasticaResults, $doctrineObjects) { @@ -205,6 +220,9 @@ public function testResultsAreSortedByIdentifier($elasticaResults, $doctrineObje /** * @dataProvider resultsWithMatchingObjects + * + * @param mixed $elasticaResults + * @param mixed $doctrineObjects */ public function testHybridTransformReturnsDecoratedResults($elasticaResults, $doctrineObjects) { @@ -252,6 +270,8 @@ private function createMockPropertyAccessor() } /** + * @param mixed $options + * * @return \PHPUnit\Framework\MockObject\MockObject|AbstractElasticaToModelTransformer */ private function createMockTransformer($options = []) diff --git a/tests/Unit/Index/IndexTemplateManagerTest.php b/tests/Unit/Index/IndexTemplateManagerTest.php index 442fd49b0..973588e43 100644 --- a/tests/Unit/Index/IndexTemplateManagerTest.php +++ b/tests/Unit/Index/IndexTemplateManagerTest.php @@ -27,6 +27,7 @@ class IndexTemplateManagerTest extends TestCase * * @param string $name * @param string|null $expectedException + * @param mixed $expectedTemplate * * @return void * diff --git a/tests/Unit/Logger/ElasticaLoggerTest.php b/tests/Unit/Logger/ElasticaLoggerTest.php index 3e65f692a..550938297 100644 --- a/tests/Unit/Logger/ElasticaLoggerTest.php +++ b/tests/Unit/Logger/ElasticaLoggerTest.php @@ -125,6 +125,8 @@ public function logLevels() /** * @dataProvider logLevels + * + * @param mixed $level */ public function testMessagesCanBeLoggedAtSpecificLogLevels($level) { diff --git a/tests/Unit/Provider/IndexableTest.php b/tests/Unit/Provider/IndexableTest.php index c42c2aaed..81318a19d 100644 --- a/tests/Unit/Provider/IndexableTest.php +++ b/tests/Unit/Provider/IndexableTest.php @@ -29,6 +29,9 @@ public function testIndexableUnknown() /** * @dataProvider provideIsIndexableCallbacks + * + * @param mixed $callback + * @param mixed $return */ public function testValidIndexableCallbacks($callback, $return) { @@ -42,6 +45,8 @@ public function testValidIndexableCallbacks($callback, $return) /** * @dataProvider provideInvalidIsIndexableCallbacks + * + * @param mixed $callback */ public function testInvalidIsIndexableCallbacks($callback) {