From 2c6521a5659dd4c60a32b5d9a7314e86880559be Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sat, 27 Oct 2018 13:10:59 +0200 Subject: [PATCH] TASK: Fix phpdocs and type hints --- .../Connection/Elasticsearch/IndexFactory.php | 2 +- .../Elasticsearch/MappingFactory.php | 2 +- .../TcaRelationResolvingProcessor.php | 1 + Classes/Domain/Index/AbstractIndexer.php | 2 +- Classes/Domain/Index/IndexerFactory.php | 2 +- Classes/Domain/Model/ResultItem.php | 4 +-- Classes/Domain/Model/SearchRequest.php | 30 ++++--------------- Classes/Domain/Model/SearchResult.php | 1 + Classes/Hook/DataHandler.php | 9 +++--- .../Form/Finisher/DataHandlerFinisher.php | 5 ++-- .../DataHandler/AbstractDataHandlerTest.php | 3 -- .../Functional/Indexing/PagesIndexerTest.php | 2 -- 12 files changed, 21 insertions(+), 42 deletions(-) diff --git a/Classes/Connection/Elasticsearch/IndexFactory.php b/Classes/Connection/Elasticsearch/IndexFactory.php index 685d6ff..20f5b1b 100644 --- a/Classes/Connection/Elasticsearch/IndexFactory.php +++ b/Classes/Connection/Elasticsearch/IndexFactory.php @@ -68,7 +68,7 @@ class IndexFactory implements Singleton */ public function getIndexName(): string { - return (string)$this->configuration->get('connections.elasticsearch.index'); + return $this->configuration->get('connections.elasticsearch.index'); } /** diff --git a/Classes/Connection/Elasticsearch/MappingFactory.php b/Classes/Connection/Elasticsearch/MappingFactory.php index 5579cd2..abaf62f 100644 --- a/Classes/Connection/Elasticsearch/MappingFactory.php +++ b/Classes/Connection/Elasticsearch/MappingFactory.php @@ -50,7 +50,7 @@ class MappingFactory implements Singleton * @param string $documentType * @return \Elastica\Type\Mapping */ - public function getMapping(\Elastica\Type $type, $documentType = null): \Elastica\Type\Mapping + public function getMapping(\Elastica\Type $type, string $documentType = null): \Elastica\Type\Mapping { $mapping = new \Elastica\Type\Mapping(); $mapping->setType($type); diff --git a/Classes/DataProcessing/TcaRelationResolvingProcessor.php b/Classes/DataProcessing/TcaRelationResolvingProcessor.php index b0ffce8..410a2e1 100644 --- a/Classes/DataProcessing/TcaRelationResolvingProcessor.php +++ b/Classes/DataProcessing/TcaRelationResolvingProcessor.php @@ -58,6 +58,7 @@ class TcaRelationResolvingProcessor implements ProcessorInterface * @param array $record * @param array $configuration * @return array + * @throws \InvalidArgumentException If _table is not configured. */ public function processData(array $record, array $configuration): array { diff --git a/Classes/Domain/Index/AbstractIndexer.php b/Classes/Domain/Index/AbstractIndexer.php index afe61e9..9057f90 100644 --- a/Classes/Domain/Index/AbstractIndexer.php +++ b/Classes/Domain/Index/AbstractIndexer.php @@ -145,7 +145,7 @@ abstract class AbstractIndexer implements IndexerInterface /** * @return \Generator */ - protected function getRecordGenerator() + protected function getRecordGenerator(): \Generator { $offset = 0; $limit = $this->getLimit(); diff --git a/Classes/Domain/Index/IndexerFactory.php b/Classes/Domain/Index/IndexerFactory.php index 68f3771..ca3051b 100644 --- a/Classes/Domain/Index/IndexerFactory.php +++ b/Classes/Domain/Index/IndexerFactory.php @@ -75,7 +75,7 @@ class IndexerFactory implements Singleton /** * @param string $indexerClass * @param string $identifier - * @return \Codappix\SearchCore\Domain\Index\IndexerInterface + * @return IndexerInterface * @throws NoMatchingIndexerException */ protected function buildIndexer(string $indexerClass, string $identifier): IndexerInterface diff --git a/Classes/Domain/Model/ResultItem.php b/Classes/Domain/Model/ResultItem.php index 324ffd4..0230fe6 100644 --- a/Classes/Domain/Model/ResultItem.php +++ b/Classes/Domain/Model/ResultItem.php @@ -2,8 +2,6 @@ namespace Codappix\SearchCore\Domain\Model; -use Codappix\SearchCore\Connection\ResultItemInterface; - /* * Copyright (C) 2017 Daniel Siepmann * @@ -23,6 +21,8 @@ use Codappix\SearchCore\Connection\ResultItemInterface; * 02110-1301, USA. */ +use Codappix\SearchCore\Connection\ResultItemInterface; + class ResultItem implements ResultItemInterface { /** diff --git a/Classes/Domain/Model/SearchRequest.php b/Classes/Domain/Model/SearchRequest.php index 787a936..17ef197 100644 --- a/Classes/Domain/Model/SearchRequest.php +++ b/Classes/Domain/Model/SearchRequest.php @@ -24,6 +24,7 @@ namespace Codappix\SearchCore\Domain\Model; use Codappix\SearchCore\Connection\ConnectionInterface; use Codappix\SearchCore\Connection\FacetRequestInterface; use Codappix\SearchCore\Connection\SearchRequestInterface; +use Codappix\SearchCore\Connection\SearchResultInterface; use Codappix\SearchCore\Domain\Search\SearchService; use Codappix\SearchCore\Utility\ArrayUtility as CustomArrayUtility; use TYPO3\CMS\Core\Utility\ArrayUtility; @@ -158,12 +159,12 @@ class SearchRequest implements SearchRequestInterface $this->searchService = $searchService; } + // Extbase QueryInterface + // Current implementation covers only paginate widget support. + /** - * Extbase QueryInterface - * Current implementation covers only paginate widget support. - * * @param bool $returnRawQueryResult - * @return array|\Codappix\SearchCore\Connection\SearchResultInterface|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface + * @return SearchResultInterface * @throws \InvalidArgumentException */ public function execute($returnRawQueryResult = false) @@ -223,7 +224,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface|void * @throws \BadMethodCallException */ public function getSource() @@ -233,7 +233,6 @@ class SearchRequest implements SearchRequestInterface /** * @param array $orderings - * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface|void * @throws \BadMethodCallException */ public function setOrderings(array $orderings) @@ -243,7 +242,6 @@ class SearchRequest implements SearchRequestInterface /** * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint - * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface|void * @throws \BadMethodCallException */ public function matching($constraint) @@ -253,7 +251,6 @@ class SearchRequest implements SearchRequestInterface /** * @param mixed $constraint1 - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface|void * @throws \BadMethodCallException */ public function logicalAnd($constraint1) @@ -263,7 +260,6 @@ class SearchRequest implements SearchRequestInterface /** * @param mixed $constraint1 - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface|void * @throws \BadMethodCallException */ public function logicalOr($constraint1) @@ -273,7 +269,6 @@ class SearchRequest implements SearchRequestInterface /** * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface|void * @throws \BadMethodCallException */ public function logicalNot(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint) @@ -285,7 +280,6 @@ class SearchRequest implements SearchRequestInterface * @param string $propertyName * @param mixed $operand * @param bool $caseSensitive - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function equals($propertyName, $operand, $caseSensitive = true) @@ -297,7 +291,6 @@ class SearchRequest implements SearchRequestInterface * @param string $propertyName * @param string $operand * @param bool $caseSensitive - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function like($propertyName, $operand, $caseSensitive = true) @@ -308,7 +301,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName * @param mixed $operand - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function contains($propertyName, $operand) @@ -319,7 +311,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName * @param mixed $operand - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function in($propertyName, $operand) @@ -330,7 +321,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName * @param mixed $operand - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function lessThan($propertyName, $operand) @@ -341,7 +331,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName * @param mixed $operand - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function lessThanOrEqual($propertyName, $operand) @@ -352,7 +341,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName * @param mixed $operand - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function greaterThan($propertyName, $operand) @@ -363,7 +351,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName * @param mixed $operand - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface|void * @throws \BadMethodCallException */ public function greaterThanOrEqual($propertyName, $operand) @@ -372,7 +359,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return string|void * @throws \BadMethodCallException */ public function getType() @@ -390,7 +376,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface|void * @throws \BadMethodCallException */ public function getQuerySettings() @@ -399,7 +384,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return integer|void * @throws \BadMethodCallException */ public function count() @@ -408,7 +392,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return array|void * @throws \BadMethodCallException */ public function getOrderings() @@ -417,7 +400,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return null|\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface|void * @throws \BadMethodCallException */ public function getConstraint() @@ -427,7 +409,6 @@ class SearchRequest implements SearchRequestInterface /** * @param string $propertyName - * @return bool|void * @throws \BadMethodCallException */ public function isEmpty($propertyName) @@ -445,7 +426,6 @@ class SearchRequest implements SearchRequestInterface } /** - * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement|void * @throws \BadMethodCallException */ public function getStatement() diff --git a/Classes/Domain/Model/SearchResult.php b/Classes/Domain/Model/SearchResult.php index a4f494d..97a12fb 100644 --- a/Classes/Domain/Model/SearchResult.php +++ b/Classes/Domain/Model/SearchResult.php @@ -21,6 +21,7 @@ namespace Codappix\SearchCore\Domain\Model; * 02110-1301, USA. */ +use Codappix\SearchCore\Connection\ResultItemInterface; use Codappix\SearchCore\Connection\SearchResultInterface; /** diff --git a/Classes/Hook/DataHandler.php b/Classes/Hook/DataHandler.php index 3015cc0..8f6b8c9 100644 --- a/Classes/Hook/DataHandler.php +++ b/Classes/Hook/DataHandler.php @@ -22,11 +22,12 @@ namespace Codappix\SearchCore\Hook; */ use Codappix\SearchCore\Configuration\NoConfigurationException; +use Codappix\SearchCore\Domain\Index\NoMatchingIndexerException; use Codappix\SearchCore\Domain\Service\DataHandler as OwnDataHandler; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\DataHandling\DataHandler as CoreDataHandler; -use TYPO3\CMS\Core\Log\Logger; use TYPO3\CMS\Core\Log\LogManager; +use TYPO3\CMS\Core\Log\Logger; use TYPO3\CMS\Core\SingletonInterface as Singleton; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; @@ -93,7 +94,7 @@ class DataHandler implements Singleton /** * @param CoreDataHandler $dataHandler * @return void - * @throws \Codappix\SearchCore\Domain\Index\NoMatchingIndexerException + * @throws NoMatchingIndexerException */ public function processDatamap_afterAllOperations(CoreDataHandler $dataHandler) { @@ -119,7 +120,7 @@ class DataHandler implements Singleton * @param array $parameters * @param CoreDataHandler $dataHandler * @return void - * @throws \Codappix\SearchCore\Domain\Index\NoMatchingIndexerException + * @throws NoMatchingIndexerException */ public function clearCachePostProc(array $parameters, CoreDataHandler $dataHandler) { @@ -143,7 +144,7 @@ class DataHandler implements Singleton * @param string $table * @param integer $uid * @return bool - * @throws \Codappix\SearchCore\Domain\Index\NoMatchingIndexerException + * @throws NoMatchingIndexerException */ protected function processRecord(string $table, int $uid): bool { diff --git a/Classes/Integration/Form/Finisher/DataHandlerFinisher.php b/Classes/Integration/Form/Finisher/DataHandlerFinisher.php index ee49649..c98660f 100644 --- a/Classes/Integration/Form/Finisher/DataHandlerFinisher.php +++ b/Classes/Integration/Form/Finisher/DataHandlerFinisher.php @@ -21,6 +21,7 @@ namespace Codappix\SearchCore\Integration\Form\Finisher; * 02110-1301, USA. */ +use Codappix\SearchCore\Domain\Index\NoMatchingIndexerException; use TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher; use TYPO3\CMS\Form\Domain\Finishers\Exception\FinisherException; @@ -48,9 +49,9 @@ class DataHandlerFinisher extends AbstractFinisher ]; /** - * @return null|string|void + * @return void * @throws FinisherException - * @throws \Codappix\SearchCore\Domain\Index\NoMatchingIndexerException + * @throws NoMatchingIndexerException */ protected function executeInternal() { diff --git a/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php b/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php index 0717cc7..9da72f0 100644 --- a/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php +++ b/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php @@ -36,9 +36,6 @@ abstract class AbstractDataHandlerTest extends AbstractFunctionalTestCase */ protected $subject; - /** - * @throws \Doctrine\DBAL\DBALException - */ public function setUp() { parent::setUp(); diff --git a/Tests/Functional/Indexing/PagesIndexerTest.php b/Tests/Functional/Indexing/PagesIndexerTest.php index 3a080ea..08821e5 100644 --- a/Tests/Functional/Indexing/PagesIndexerTest.php +++ b/Tests/Functional/Indexing/PagesIndexerTest.php @@ -67,8 +67,6 @@ class PagesIndexerTest extends AbstractFunctionalTestCase * @test * @dataProvider rootLineDataSets * @param string $dataSetPath - * @throws \Codappix\SearchCore\Domain\Index\NoMatchingIndexerException - * @throws \TYPO3\TestingFramework\Core\Exception */ public function rootLineIsRespectedDuringIndexing($dataSetPath) {