Skip to content

Commit 476d3ee

Browse files
authored
Merge pull request #420 from kdambekalns/task/code-cleanup
Code cleanup
2 parents bc0b72f + 2ad9ba3 commit 476d3ee

26 files changed

Lines changed: 81 additions & 84 deletions

Classes/AssetExtraction/IngestAttachmentAssetExtractor.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
* source code.
1414
*/
1515

16+
use Flowpack\ElasticSearch\Transfer\Exception\ApiException;
1617
use Neos\Flow\Annotations as Flow;
1718
use Neos\ContentRepository\Search\AssetExtraction\AssetExtractorInterface;
1819
use Neos\ContentRepository\Search\Dto\AssetContent;
1920
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\ElasticSearchClient;
21+
use Neos\Flow\Http\Exception;
2022
use Neos\Flow\Log\ThrowableStorageInterface;
2123
use Neos\Flow\Log\Utility\LogEnvironment;
2224
use Neos\Media\Domain\Model\AssetInterface;
@@ -58,8 +60,8 @@ class IngestAttachmentAssetExtractor implements AssetExtractorInterface
5860
* @param AssetInterface $asset
5961
* @return AssetContent
6062
* @throws \Flowpack\ElasticSearch\Transfer\Exception
61-
* @throws \Flowpack\ElasticSearch\Transfer\Exception\ApiException
62-
* @throws \Neos\Flow\Http\Exception
63+
* @throws ApiException
64+
* @throws Exception
6365
*/
6466
public function extract(AssetInterface $asset): AssetContent
6567
{
@@ -132,7 +134,7 @@ protected function getAssetContent(AssetInterface $asset): string
132134
}
133135

134136
/**
135-
* @param $extractedAsset
137+
* @param ?array $extractedAsset
136138
* @return AssetContent
137139
*/
138140
protected function buildAssetContentObject(?array $extractedAsset): AssetContent

Classes/Client/ClientFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\ElasticSearchClient;
1717
use Flowpack\ElasticSearch\Domain\Model\Client;
18+
use Flowpack\ElasticSearch\Exception;
1819
use Neos\Flow\Annotations as Flow;
1920

2021
/**
@@ -32,7 +33,7 @@ class ClientFactory
3233
* Create a client
3334
*
3435
* @return Client
35-
* @throws \Flowpack\ElasticSearch\Exception
36+
* @throws Exception
3637
*/
3738
public function create(): Client
3839
{

Classes/Command/NodeTypeCommandController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* source code.
1414
*/
1515

16+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception;
1617
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Service\NodeTypeIndexingConfiguration;
1718
use Neos\ContentRepository\Domain\Model\NodeType;
1819
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
@@ -69,7 +70,7 @@ public function showCommand(?string $nodeType = null): void
6970
/**
7071
* Shows a list of NodeTypes and if they are configured to be indexable or not
7172
*
72-
* @throws \Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception
73+
* @throws Exception
7374
*/
7475
public function showIndexableConfigurationCommand(): void
7576
{

Classes/Command/SearchCommandController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ private function outputResults(ElasticSearchQueryResult $result): void
148148

149149
foreach ($node->getProperties() as $propertyName => $propertyValue) {
150150
if ($propertyValue instanceof ResourceBasedInterface) {
151-
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . (string)$propertyValue->getResource()->getFilename();
151+
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . $propertyValue->getResource()->getFilename();
152152
} elseif ($propertyValue instanceof \DateTime) {
153153
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . $propertyValue->format('Y-m-d H:i');
154154
} elseif (is_array($propertyValue)) {
155155
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . 'array';
156156
} elseif ($propertyValue instanceof NodeInterface) {
157157
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . $propertyValue->getIdentifier();
158158
} else {
159-
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . (string)$propertyValue;
159+
$properties[$propertyName] = '<b>' . $propertyName . '</b>: ' . $propertyValue;
160160
}
161161
}
162162

Classes/Driver/AbstractIndexerDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function findClosestFulltextRoot(NodeInterface $node): ?NodeInterface
6565
if ($closestFulltextNode === null) {
6666
// root of hierarchy, no fulltext root found anymore, abort silently...
6767
if ($node->getPath() !== '/' && $node->getPath() !== '/sites') {
68-
$this->logger->warning(sprintf('NodeIndexer: No fulltext root found for node %s', (string)$node), LogEnvironment::fromMethodName(__METHOD__));
68+
$this->logger->warning(sprintf('NodeIndexer: No fulltext root found for node %s', $node), LogEnvironment::fromMethodName(__METHOD__));
6969
}
7070

7171
return null;

Classes/Driver/AbstractNodeTypeMappingBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class AbstractNodeTypeMappingBuilder implements NodeTypeMappingBuilderI
5454
/**
5555
* Called by the Flow object framework after creating the object and resolving all dependencies.
5656
*
57-
* @param integer $cause Creation cause
57+
* @param int $cause Creation cause
5858
* @throws InvalidConfigurationTypeException
5959
*/
6060
public function initializeObject($cause): void

Classes/Driver/AbstractQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ protected function prepareRequest(): array
278278
* All methods are considered safe
279279
*
280280
* @param string $methodName
281-
* @return boolean
281+
* @return bool
282282
*/
283283
public function allowsCallOfMethod($methodName)
284284
{

Classes/Driver/DocumentDriverInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
* source code.
1515
*/
1616

17-
use Flowpack\ElasticSearch\Domain\Model\Index;
1817
use Neos\ContentRepository\Domain\Model\NodeInterface;
19-
use Neos\ContentRepository\Domain\Model\NodeType;
2018

2119
/**
2220
* Elasticsearch Document Driver Interface

Classes/Driver/NodeTypeMappingBuilderInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
use Flowpack\ElasticSearch\Domain\Model\Index;
18+
use Flowpack\ElasticSearch\Domain\Model\Mapping;
1819
use Flowpack\ElasticSearch\Mapping\MappingCollection;
1920
use Neos\Error\Messages\Result;
2021

@@ -27,7 +28,7 @@ interface NodeTypeMappingBuilderInterface
2728
* Builds a Mapping Collection from the configured node types
2829
*
2930
* @param Index $index
30-
* @return MappingCollection<\Flowpack\ElasticSearch\Domain\Model\Mapping>
31+
* @return MappingCollection<Mapping>
3132
*/
3233
public function buildMappingInformation(Index $index): MappingCollection;
3334

Classes/Driver/QueryInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function addSortFilter(array $configuration): void;
5656
/**
5757
* Set the size (limit) of the request
5858
*
59-
* @param integer $size
59+
* @param int $size
6060
* @return void
6161
* @api
6262
*/
@@ -65,7 +65,7 @@ public function size(int $size): void;
6565
/**
6666
* Set the from (offset) of the request
6767
*
68-
* @param integer $size
68+
* @param int $size
6969
* @return void
7070
* @api
7171
*/
@@ -95,7 +95,7 @@ public function simpleQueryStringFulltext(string $searchWord, array $options = [
9595
* Configure Result Highlighting. Only makes sense in combination with fulltext(). By default, highlighting is enabled.
9696
* It can be disabled by calling "highlight(FALSE)".
9797
*
98-
* @param integer|boolean $fragmentSize The result fragment size for highlight snippets. If this parameter is FALSE, highlighting will be disabled.
98+
* @param int|bool $fragmentSize The result fragment size for highlight snippets. If this parameter is FALSE, highlighting will be disabled.
9999
* @param int|null $fragmentCount The number of highlight fragments to show.
100100
* @param int $noMatchSize
101101
* @param string $field

0 commit comments

Comments
 (0)