Skip to content

Commit

Permalink
removed usage of deprecated Fidry/Console elements
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Jul 30, 2024
1 parent 15365c8 commit 6c8d323
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Changed-20240730-045524.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Changed
body: removed usage of deprecated Fidry/Console elements
time: 2024-07-30T04:55:24.108820146Z
13 changes: 6 additions & 7 deletions src/Composer/ManifestOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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();
}
}
2 changes: 1 addition & 1 deletion src/Composer/PostInstallStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Composer\Script\Event;

use Fidry\Console\Input\IO;
use Fidry\Console\IO;

use KevinGH\Box\Configuration\ConfigurationLoader;

Expand Down
4 changes: 2 additions & 2 deletions src/Console/Command/ManifestBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
10 changes: 5 additions & 5 deletions src/Console/Command/ManifestStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
);

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/BoxHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6c8d323

Please sign in to comment.