mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-16 10:14:54 -06:00
Improved mezzio-swoole helper script to ensure it only applies to mezzio:swoole commands
This commit is contained in:
parent
e3ff447152
commit
a9704c6e2f
10
vendor/bin/mezzio-swoole
vendored
10
vendor/bin/mezzio-swoole
vendored
@ -18,16 +18,22 @@ use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
|
||||
|
||||
use function explode;
|
||||
use function Functional\filter;
|
||||
use function str_starts_with;
|
||||
use function strstr;
|
||||
|
||||
/** @var ServiceManager $container */
|
||||
$container = require __DIR__ . '/../../config/container.php';
|
||||
$version = strstr(Versions::getVersion('mezzio/mezzio-swoole'), '@', true);
|
||||
$commands = $container->get('config')['laminas-cli']['commands'] ?? [];
|
||||
$commandsPrefix = 'mezzio:swoole:';
|
||||
$commands = filter(
|
||||
$container->get('config')['laminas-cli']['commands'] ?? [],
|
||||
fn ($c, string $command) => str_starts_with($command, $commandsPrefix),
|
||||
);
|
||||
$registeredCommands = [];
|
||||
|
||||
foreach ($commands as $newName => $commandServiceName) {
|
||||
[, $oldName] = explode('mezzio:swoole:', $newName);
|
||||
[, $oldName] = explode($commandsPrefix, $newName);
|
||||
$registeredCommands[$oldName] = $commandServiceName;
|
||||
|
||||
$container->addDelegator($commandServiceName, static function ($c, $n, callable $factory) use ($oldName) {
|
||||
|
Loading…
Reference in New Issue
Block a user