Skip to content

Commit 37f9d1d

Browse files
authored
Merge pull request #1667 from XWB/cleanup2
Some more cleanup
2 parents 330e77e + 7bf1fd4 commit 37f9d1d

File tree

14 files changed

+18
-22
lines changed

14 files changed

+18
-22
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ return PhpCsFixer\Config::create()
2222
'ordered_imports' => true,
2323
'phpdoc_no_empty_return' => false,
2424
'ternary_to_null_coalescing' => true,
25+
'nullable_type_declaration_for_default_null_value' => true,
2526
])
2627
->setUsingCache(true)
2728
->setFinder(

src/DataCollector/ElasticaDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(ElasticaLogger $logger)
3030
$this->logger = $logger;
3131
}
3232

33-
public function collect(Request $request, Response $response, \Throwable $exception = null)
33+
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
3434
{
3535
$this->data['nb_queries'] = $this->logger->getNbQueries();
3636
$this->data['queries'] = $this->logger->getQueries();

src/Doctrine/Listener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function __construct(
8080
ObjectPersisterInterface $objectPersister,
8181
IndexableInterface $indexable,
8282
array $config = [],
83-
LoggerInterface $logger = null
83+
?LoggerInterface $logger = null
8484
) {
8585
$this->config = array_merge([
8686
'identifier' => 'id',

src/Doctrine/RepositoryManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(ManagerRegistry $managerRegistry, RepositoryManagerI
4747
/**
4848
* {@inheritdoc}
4949
*/
50-
public function addIndex(string $indexName, FinderInterface $finder, string $repositoryName = null): void
50+
public function addIndex(string $indexName, FinderInterface $finder, ?string $repositoryName = null): void
5151
{
5252
throw new \LogicException(__METHOD__.' should not be called. Call addIndex on the main repository manager');
5353
}

src/Elastica/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getIndexTemplate($name): IndexTemplate
104104
/**
105105
* Sets a stopwatch instance for debugging purposes.
106106
*/
107-
public function setStopwatch(?Stopwatch $stopwatch = null)
107+
public function setStopwatch(?Stopwatch $stopwatch = null): void
108108
{
109109
$this->stopwatch = $stopwatch;
110110
}

src/Elastica/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getOriginalName(): string
3737
* While it's technically a regular setter for name property, it's specifically named overrideName, but not setName
3838
* since it's used for a very specific case and normally should not be used
3939
*/
40-
public function overrideName(string $name)
40+
public function overrideName(string $name): void
4141
{
4242
$this->originalName = $this->_name;
4343
$this->_name = $name;

src/Finder/FinderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ interface FinderInterface
1616
/**
1717
* Searches for query results within a given limit.
1818
*
19-
* @param mixed $query Can be a string, an array or an \Elastica\Query object
20-
* @param int|null $limit How many results to get
19+
* @param mixed $query Can be a string, an array or an \Elastica\Query object
20+
* @param int|null $limit How many results to get
2121
*
2222
* @return array results
2323
*/

src/Finder/PaginatedFinderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface PaginatedFinderInterface extends FinderInterface
2323
/**
2424
* Searches for query results and returns them wrapped in a paginator.
2525
*
26-
* @param mixed $query Can be a string, an array or an \Elastica\Query object
26+
* @param mixed $query Can be a string, an array or an \Elastica\Query object
2727
*
2828
* @return Pagerfanta paginated results
2929
*/

src/Manager/RepositoryManagerInterface.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,19 @@ interface RepositoryManagerInterface
2525
/**
2626
* Adds index name and its finder.
2727
* Custom repository class name can also be added.
28-
*
29-
* @param string $indexName The type name in "index/type" format
30-
* @param string $repositoryName
3128
*/
32-
public function addIndex(string $indexName, FinderInterface $finder, string $repositoryName = null): void;
29+
public function addIndex(string $indexName, FinderInterface $finder, ?string $repositoryName = null): void;
3330

3431
/**
3532
* Return repository for entity.
3633
*
3734
* Returns custom repository if one specified otherwise
3835
* returns a basic repository.
39-
*
40-
* @param $indexName
4136
*/
4237
public function getRepository(string $indexName): Repository;
4338

39+
/**
40+
* Check whether a repository exists for the index.
41+
*/
4442
public function hasRepository(string $indexName): bool;
4543
}

src/Paginator/FantaPaginatorAdapter.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ class FantaPaginatorAdapter implements AdapterInterface
1717
{
1818
private $adapter;
1919

20-
/**
21-
* @param \FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface $adapter
22-
*/
2320
public function __construct(PaginatorAdapterInterface $adapter)
2421
{
2522
$this->adapter = $adapter;

0 commit comments

Comments
 (0)