Skip to content

Commit

Permalink
Fix new weird issue with PHPstan analyzer in sharding Table component
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Jun 4, 2024
1 parent 8d555e9 commit f944ba8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Plugin/Sharding/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,13 @@ public function cleanUpNode(Queue $queue, string $nodeId, Set $shards): static {
*/
protected function getShardNodesMap(Vector $schema): Map {
return $schema->reduce(
/** @var Map<int,Set<string>> $map */
function (Map $map, $row): Map {
foreach ($row['shards'] as $shard) {
$map[$shard] ??= new Set;
// Hack for stupic phpstan that cannot recognize it
if (!$map[$shard] instanceof Set) {
continue;
}
$map[$shard]->add($row['node']);
/** @var Set<string> $set */
$set = $map->get($shard, new Set);
$set->add($row['node']);
$map->put($shard, $set);
}
return $map;
}, new Map
Expand Down

0 comments on commit f944ba8

Please sign in to comment.