Skip to content

Commit daeb41f

Browse files
committed
🚨 Fix getMostCommonName returns ?string
Declaring a `non-empty-list` (with `__construct(private string $stableName, string $value)` proved to be impracticable regarding usage changes.
1 parent 4f5d9d7 commit daeb41f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/MappingEntry.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
use function array_count_values;
88
use function array_key_first;
99
use function arsort;
10+
use function assert;
1011

1112
class MappingEntry
1213
{
13-
/** @var array<string> */
14+
/** @var list<string> */
1415
private array $names = [];
1516

1617
public function __construct(private string $stableName)
@@ -29,6 +30,7 @@ public function getStableName(): string
2930

3031
public function getMostCommonName(): string
3132
{
33+
assert(! empty($this->names));
3234
$values = array_count_values($this->names);
3335
arsort($values);
3436

0 commit comments

Comments
 (0)