Skip to content

Commit f90d00b

Browse files
authored
Fix Implicitly nullable markings (#43)
1 parent c6c7d43 commit f90d00b

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/Finder/SourceFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function findMultiple(SourceCriteria $criteria): array
5656
*
5757
* @throws \RuntimeException
5858
*/
59-
public function findRelatedSourceRecords(SourceCriteria $criteria, int $limit = null): array
59+
public function findRelatedSourceRecords(SourceCriteria $criteria, ?int $limit = null): array
6060
{
6161
if (0 === \count($criteria->getIds())) {
6262
throw new \RuntimeException('No IDs have been provided');

src/Finder/TagFinder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function findMultiple(TagCriteria $criteria): array
8989
/**
9090
* Get the top tags. The tag count will be part of tag's data ($tag->getData()['count']).
9191
*/
92-
public function getTopTags(TagCriteria $criteria, int $limit = null, bool $withCount = false): array
92+
public function getTopTags(TagCriteria $criteria, ?int $limit = null, bool $withCount = false): array
9393
{
9494
if (0 === \count($tagIds = $this->getTopTagIds($criteria, $limit, $withCount))) {
9595
return [];
@@ -111,7 +111,7 @@ public function getTopTags(TagCriteria $criteria, int $limit = null, bool $withC
111111
/**
112112
* Get the top tag IDs.
113113
*/
114-
public function getTopTagIds(TagCriteria $criteria, int $limit = null, bool $withCount = false): array
114+
public function getTopTagIds(TagCriteria $criteria, ?int $limit = null, bool $withCount = false): array
115115
{
116116
// No array_unique() here!
117117
$tagIds = DcaRelationsModel::getRelatedValues($criteria->getSourceTable(), $criteria->getSourceField(), $criteria->getSourceIds());

src/Manager/DefaultManager.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ public function setSourceFinder(SourceFinder $sourceFinder): void
7171
/**
7272
* {@inheritdoc}
7373
*/
74-
public function getAllTags(string $source = null): array
74+
public function getAllTags(?string $source = null): array
7575
{
7676
return $this->tagFinder->findMultiple($this->createTagCriteria($source));
7777
}
7878

7979
/**
8080
* {@inheritdoc}
8181
*/
82-
public function getFilteredTags(array $values, string $source = null): array
82+
public function getFilteredTags(array $values, ?string $source = null): array
8383
{
8484
$criteria = $this->createTagCriteria($source);
8585
$criteria->setValues(\count($values) ? $values : [0]);
@@ -203,7 +203,7 @@ public function getSourceRecordsCount(array $data, DataContainer $dc): int
203203
/**
204204
* {@inheritdoc}
205205
*/
206-
public function getTopTagIds(string $source = null): array
206+
public function getTopTagIds(?string $source = null): array
207207
{
208208
$ids = [];
209209
$sources = (null !== $source) ? [$source] : $this->sources;
@@ -259,7 +259,7 @@ public function getTagFinder(): TagFinder
259259
/**
260260
* Create the tag criteria.
261261
*/
262-
public function createTagCriteria(string $source = null): TagCriteria
262+
public function createTagCriteria(?string $source = null): TagCriteria
263263
{
264264
return new TagCriteria($this->name, $this->getSource($source));
265265
}
@@ -275,15 +275,15 @@ public function getSourceFinder(): SourceFinder
275275
/**
276276
* Create the source criteria.
277277
*/
278-
public function createSourceCriteria(string $source = null): SourceCriteria
278+
public function createSourceCriteria(?string $source = null): SourceCriteria
279279
{
280280
return new SourceCriteria($this->name, $this->getSource($source));
281281
}
282282

283283
/**
284284
* Get the source.
285285
*/
286-
protected function getSource(string $source = null): string
286+
protected function getSource(?string $source = null): string
287287
{
288288
if (null === $source) {
289289
$source = $this->sources[0];
@@ -297,7 +297,7 @@ protected function getSource(string $source = null): string
297297
/**
298298
* Generate the tag alias.
299299
*/
300-
protected function generateAlias(TagModel $model, string $source = null): void
300+
protected function generateAlias(TagModel $model, ?string $source = null): void
301301
{
302302
$alias = StringUtil::generateAlias($model->name);
303303

src/Manager/ManagerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ interface ManagerInterface
1717
/**
1818
* Get all tags.
1919
*/
20-
public function getAllTags(string $source = null): array;
20+
public function getAllTags(?string $source = null): array;
2121

2222
/**
2323
* Get tags optionally filtered by values.
2424
*/
25-
public function getFilteredTags(array $values, string $source = null): array;
25+
public function getFilteredTags(array $values, ?string $source = null): array;
2626
}

tests/Fixtures/DummyManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public function getSourceRecordsCount(array $data, DataContainer $dc): int
4444
/**
4545
* @inheritDoc
4646
*/
47-
public function getAllTags(string $source = null): array
47+
public function getAllTags(?string $source = null): array
4848
{
4949
return [];
5050
}
5151

5252
/**
5353
* @inheritDoc
5454
*/
55-
public function getFilteredTags(array $values, string $source = null): array
55+
public function getFilteredTags(array $values, ?string $source = null): array
5656
{
5757
return [];
5858
}

0 commit comments

Comments
 (0)