Repository: shlinkio/shlink (PHP)

Issue:
Remove deprecated `--tags` option from console commands using it
Some console commands used to support providing a comma-separated list of tags via `--tags`. This was then replaced with the ability to provide `--tag` multiple times, but `--tags` was kept for backwards compatibility.

Let's remove that now and simplify the logic to read tags.



Fix (patch):
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61e3a31ad..a63660aac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
 * [#2517](https://github.com/shlinkio/shlink/issues/2517) Remove `REDIRECT_APPEND_EXTRA_PATH` env var. Use `REDIRECT_EXTRA_PATH_MODE=append` instead.
 * [#2519](https://github.com/shlinkio/shlink/issues/2519) Disabling API keys by their plain-text key is no longer supported. When calling `api-key:disable`, the first argument is now always assumed to be the name.
 * [#2520](https://github.com/shlinkio/shlink/issues/2520) Remove deprecated `--including-all-tags` and `--show-api-key-name` deprecated options from `short-url:list` command. Use `--tags-all` and `--show-api-key` instead.
+* [#2521](https://github.com/shlinkio/shlink/issues/2521) Remove deprecated `--tags` option in all commands using it. Use `--tag` multiple times instead, one per tag.
 
 ### Fixed
 * *Nothing*
diff --git a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php
index c1c5df4f7..99c445f08 100644
--- a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php
+++ b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php
@@ -76,7 +76,7 @@ protected function configure(): void
             ->addOption(
                 'tags-all',
                 mode: InputOption::VALUE_NONE,
-                description: 'If --tags is provided, returns only short URLs including ALL of them',
+                description: 'If --tag is provided, returns only short URLs including ALL of them',
             )
             ->addOption(
                 'exclude-tag',
diff --git a/module/CLI/src/Input/TagsOption.php b/module/CLI/src/Input/TagsOption.php
index ff02a7353..1cdee7e8f 100644
--- a/module/CLI/src/Input/TagsOption.php
+++ b/module/CLI/src/Input/TagsOption.php
@@ -8,10 +8,7 @@
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 
-use function array_map;
 use function array_unique;
-use function Shlinkio\Shlink\Core\ArrayUtils\flatten;
-use function Shlinkio\Shlink\Core\splitByComma;
 
 readonly class TagsOption
 {
@@ -23,20 +20,15 @@ public function __construct(Command $command, string $description)
                 't',
                 InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                 $description,
-            )
-            ->addOption(
-                'tags',
-                mode: InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
-                description: '[DEPRECATED] Use --tag instead',
             );
     }
 
     /**
-     * Whether tags have been set or not, via `--tag`, `-t` or the deprecated `--tags`
+     * Whether tags have been set or not, via `--tag` or `-t`
      */
     public function exists(InputInterface $input): bool
     {
-        return $input->hasParameterOption(['--tag', '-t']) || $input->hasParameterOption('--tags');
+        return $input->hasParameterOption(['--tag', '-t']);
     }
 
     /**
@@ -44,8 +36,6 @@ public function exists(InputInterface $input): bool
      */
     public function get(InputInterface $input): array
     {
-        // FIXME DEPRECATED Remove support for comma-separated tags in next major release
-        $tags = [...$input->getOption('tag'), ...$input->getOption('tags')];
-        return array_unique(flatten(array_map(splitByComma(...), $tags)));
+        return array_unique($input->getOption('tag'));
     }
 }