Skip to content

Commit da98f40

Browse files
committed
Move array_merge calls out of loops to improve performance
1 parent 9ca59c3 commit da98f40

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Application.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,14 @@ public function getNamespaces()
573573
continue;
574574
}
575575

576-
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
576+
$namespaces[] = $this->extractAllNamespaces($command->getName());
577577

578578
foreach ($command->getAliases() as $alias) {
579-
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
579+
$namespaces[] = $this->extractAllNamespaces($alias);
580580
}
581581
}
582582

583-
return array_values(array_unique(array_filter($namespaces)));
583+
return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
584584
}
585585

586586
/**

0 commit comments

Comments
 (0)