From 6c8d3234dbd7e7db52c5de3e43ced3e48815936d Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Tue, 30 Jul 2024 04:54:16 +0000 Subject: [PATCH] removed usage of deprecated Fidry/Console elements --- .changes/unreleased/Changed-20240730-045524.yaml | 3 +++ src/Composer/ManifestOptions.php | 13 ++++++------- src/Composer/PostInstallStrategy.php | 2 +- src/Console/Command/ManifestBuild.php | 4 ++-- src/Console/Command/ManifestStub.php | 10 +++++----- src/Helper/BoxHelper.php | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 .changes/unreleased/Changed-20240730-045524.yaml diff --git a/.changes/unreleased/Changed-20240730-045524.yaml b/.changes/unreleased/Changed-20240730-045524.yaml new file mode 100644 index 0000000..94be7e9 --- /dev/null +++ b/.changes/unreleased/Changed-20240730-045524.yaml @@ -0,0 +1,3 @@ +kind: Changed +body: removed usage of deprecated Fidry/Console elements +time: 2024-07-30T04:55:24.108820146Z diff --git a/src/Composer/ManifestOptions.php b/src/Composer/ManifestOptions.php index 1ee1c7a..bb37aa8 100644 --- a/src/Composer/ManifestOptions.php +++ b/src/Composer/ManifestOptions.php @@ -9,8 +9,7 @@ use Bartlett\BoxManifest\Helper\ManifestFormat; -use Fidry\Console\Input\IO; -use Symfony\Component\Console\Style\StyleInterface; +use Fidry\Console\IO; /** * @author Laurent Laville @@ -23,18 +22,18 @@ final class ManifestOptions private const SBOM_SPEC_OPTION = 'sbom-spec'; private const OUTPUT_OPTION = 'output-file'; - public function __construct(private StyleInterface $io) + public function __construct(private IO $io) { } public function getBootstrap(): ?string { - return $this->io->getOption(self::BOOTSTRAP_OPTION)->asNullableString(); + return $this->io->getTypedOption(self::BOOTSTRAP_OPTION)->asNullableString(); } public function getFormat(bool $raw = false): string|null|ManifestFormat { - $rawFormat = $this->io->getOption(self::FORMAT_OPTION)->asString(); + $rawFormat = $this->io->getTypedOption(self::FORMAT_OPTION)->asString(); if ($raw) { return $rawFormat; @@ -54,11 +53,11 @@ public function getFormatDisplay(): string public function getSbomSpec(): string { - return $this->io->getOption(self::SBOM_SPEC_OPTION)->asString(); + return $this->io->getTypedOption(self::SBOM_SPEC_OPTION)->asString(); } public function getOutputFile(): ?string { - return $this->io->getOption(self::OUTPUT_OPTION)->asNullableString(); + return $this->io->getTypedOption(self::OUTPUT_OPTION)->asNullableString(); } } diff --git a/src/Composer/PostInstallStrategy.php b/src/Composer/PostInstallStrategy.php index 2671166..04d55e2 100644 --- a/src/Composer/PostInstallStrategy.php +++ b/src/Composer/PostInstallStrategy.php @@ -13,7 +13,7 @@ use Composer\Script\Event; -use Fidry\Console\Input\IO; +use Fidry\Console\IO; use KevinGH\Box\Configuration\ConfigurationLoader; diff --git a/src/Console/Command/ManifestBuild.php b/src/Console/Command/ManifestBuild.php index 85f281d..79e80ec 100644 --- a/src/Console/Command/ManifestBuild.php +++ b/src/Console/Command/ManifestBuild.php @@ -14,7 +14,7 @@ use CycloneDX\Core\Spec\Version; -use Fidry\Console\Input\IO; +use Fidry\Console\IO; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\DebugFormatterHelper; @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $config = $boxHelper->getBoxConfiguration( $io->isVerbose() ? $io : $io->withOutput(new NullOutput()), true, - $io->getOption(BoxHelper::NO_CONFIG_OPTION)->asBoolean() + $io->getTypedOption(BoxHelper::NO_CONFIG_OPTION)->asBoolean() ); $factory = new ManifestFactory($config, $output->isDecorated(), $boxHelper->getBoxVersion(), $this->getApplication()->getVersion()); diff --git a/src/Console/Command/ManifestStub.php b/src/Console/Command/ManifestStub.php index cf52d62..b8a37be 100644 --- a/src/Console/Command/ManifestStub.php +++ b/src/Console/Command/ManifestStub.php @@ -10,7 +10,7 @@ use Bartlett\BoxManifest\Helper\BoxHelper; use Bartlett\BoxManifest\Helper\ManifestHelper; -use Fidry\Console\Input\IO; +use Fidry\Console\IO; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\DebugFormatterHelper; @@ -107,12 +107,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $config = $boxHelper->getBoxConfiguration( $io->isVerbose() ? $io : $io->withOutput(new NullOutput()), true, - $io->getOption(BoxHelper::NO_CONFIG_OPTION)->asBoolean() + $io->getTypedOption(BoxHelper::NO_CONFIG_OPTION)->asBoolean() ); $stubGenerator = $manifestHelper->getStubGenerator( - $io->getOption(self::TEMPLATE_OPTION)->asNullableString(), - $io->getOption(self::RESOURCE_OPTION)->asNonEmptyStringList(), + $io->getTypedOption(self::TEMPLATE_OPTION)->asNullableString(), + $io->getTypedOption(self::RESOURCE_OPTION)->asNonEmptyStringList(), $config->getFileMapper()->getMap() ); @@ -140,7 +140,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $stub = $stubGenerator->generateStub(null, null, null, false, null, false); } - $outputFile = $io->getOption(self::OUTPUT_OPTION)->asNullableString(); + $outputFile = $io->getTypedOption(self::OUTPUT_OPTION)->asNullableString(); if (empty($outputFile)) { $output->writeln($stub); diff --git a/src/Helper/BoxHelper.php b/src/Helper/BoxHelper.php index 974e2d6..617083f 100644 --- a/src/Helper/BoxHelper.php +++ b/src/Helper/BoxHelper.php @@ -7,7 +7,7 @@ */ namespace Bartlett\BoxManifest\Helper; -use Fidry\Console\Input\IO; +use Fidry\Console\IO; use KevinGH\Box\Configuration\Configuration; use KevinGH\Box\Console\Command\ConfigOption;