Skip to content

Commit eba4b11

Browse files
authored
chore: Migrate to FidryConsole 0.6 (#903)
1 parent 514ff09 commit eba4b11

13 files changed

+154
-153
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"require": {
2020
"php": "^8.2",
21-
"fidry/console": "^0.5.0",
21+
"fidry/console": "^0.6.6",
2222
"fidry/filesystem": "^1.1",
2323
"jetbrains/phpstorm-stubs": "^v2022.2",
2424
"nikic/php-parser": "^4.12",

composer.lock

Lines changed: 122 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Console/Command/AddPrefixCommand.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Fidry\Console\Command\CommandAwareness;
2121
use Fidry\Console\Command\Configuration as CommandConfiguration;
2222
use Fidry\Console\ExitCode;
23-
use Fidry\Console\Input\IO;
23+
use Fidry\Console\IO;
2424
use Humbug\PhpScoper\Configuration\Configuration;
2525
use Humbug\PhpScoper\Configuration\ConfigurationFactory;
2626
use Humbug\PhpScoper\Console\ConfigLoader;
@@ -165,8 +165,8 @@ public function execute(IO $io): int
165165

166166
private static function getStopOnFailure(IO $io): bool
167167
{
168-
$stopOnFailure = $io->getOption(self::STOP_ON_FAILURE_OPT)->asBoolean();
169-
$continueOnFailure = $io->getOption(self::CONTINUE_ON_FAILURE_OPT)->asBoolean();
168+
$stopOnFailure = $io->getTypedOption(self::STOP_ON_FAILURE_OPT)->asBoolean();
169+
$continueOnFailure = $io->getTypedOption(self::CONTINUE_ON_FAILURE_OPT)->asBoolean();
170170

171171
if ($stopOnFailure) {
172172
$io->info(
@@ -196,7 +196,7 @@ private static function getStopOnFailure(IO $io): bool
196196
*/
197197
private function getOutputDir(IO $io, Configuration $configuration): string
198198
{
199-
$commandOutputDir = $io->getOption(self::OUTPUT_DIR_OPT)->asString();
199+
$commandOutputDir = $io->getTypedOption(self::OUTPUT_DIR_OPT)->asString();
200200

201201
if ('' !== $commandOutputDir) {
202202
return $commandOutputDir;
@@ -236,7 +236,7 @@ private static function checkPathIsWriteable(string $path): void
236236

237237
private static function canDeleteOutputDir(IO $io, string $outputDir): bool
238238
{
239-
if ($io->getOption(self::FORCE_OPT)->asBoolean()) {
239+
if ($io->getTypedOption(self::FORCE_OPT)->asBoolean()) {
240240
return true;
241241
}
242242

@@ -263,8 +263,8 @@ private function retrieveConfig(IO $io, array $paths, string $cwd): Configuratio
263263

264264
return $configLoader->loadConfig(
265265
$io,
266-
$io->getOption(self::PREFIX_OPT)->asString(),
267-
$io->getOption(self::NO_CONFIG_OPT)->asBoolean(),
266+
$io->getTypedOption(self::PREFIX_OPT)->asString(),
267+
$io->getTypedOption(self::NO_CONFIG_OPT)->asBoolean(),
268268
$this->getConfigFilePath($io, $cwd),
269269
ConfigurationFactory::DEFAULT_FILE_NAME,
270270
$this->init,
@@ -278,7 +278,7 @@ private function retrieveConfig(IO $io, array $paths, string $cwd): Configuratio
278278
*/
279279
private function getConfigFilePath(IO $io, string $cwd): ?string
280280
{
281-
$configFilePath = (string) $io->getOption(self::CONFIG_FILE_OPT)->asNullableString();
281+
$configFilePath = (string) $io->getTypedOption(self::CONFIG_FILE_OPT)->asNullableString();
282282

283283
return '' === $configFilePath ? null : $this->canonicalizePath($configFilePath, $cwd);
284284
}
@@ -290,7 +290,7 @@ private function getPathArguments(IO $io, string $cwd): array
290290
{
291291
return array_map(
292292
fn (string $path) => $this->canonicalizePath($path, $cwd),
293-
$io->getArgument(self::PATH_ARG)->asNonEmptyStringList(),
293+
$io->getTypedArgument(self::PATH_ARG)->asNonEmptyStringList(),
294294
);
295295
}
296296

src/Console/Command/ChangeableDirectory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace Humbug\PhpScoper\Console\Command;
1616

17-
use Fidry\Console\Input\IO;
17+
use Fidry\Console\IO;
1818
use Humbug\PhpScoper\NotInstantiable;
1919
use InvalidArgumentException;
2020
use Symfony\Component\Console\Exception\RuntimeException;
@@ -47,7 +47,7 @@ public static function createOption(): InputOption
4747

4848
public static function changeWorkingDirectory(IO $io): void
4949
{
50-
$workingDir = $io->getOption(self::WORKING_DIR_OPT)->asNullableString();
50+
$workingDir = $io->getTypedOption(self::WORKING_DIR_OPT)->asNullableString();
5151

5252
if (null === $workingDir) {
5353
return;

src/Console/Command/InitCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use Fidry\Console\Command\Command;
1818
use Fidry\Console\Command\Configuration as CommandConfiguration;
19-
use Fidry\Console\Input\IO;
19+
use Fidry\Console\IO;
2020
use Symfony\Component\Console\Helper\FormatterHelper;
2121
use Symfony\Component\Console\Input\InputOption;
2222
use Symfony\Component\Filesystem\Filesystem;
@@ -100,7 +100,7 @@ public function execute(IO $io): int
100100

101101
private function retrieveConfig(IO $io): ?string
102102
{
103-
$configFile = $io->getOption(self::CONFIG_FILE_OPT)->asNullableNonEmptyString();
103+
$configFile = $io->getTypedOption(self::CONFIG_FILE_OPT)->asNullableNonEmptyString();
104104

105105
$configFile = (null === $configFile)
106106
? $this->makeAbsolutePath(self::CONFIG_FILE_DEFAULT)

src/Console/Command/InspectCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Fidry\Console\Command\CommandAwareness;
2020
use Fidry\Console\Command\Configuration as CommandConfiguration;
2121
use Fidry\Console\ExitCode;
22-
use Fidry\Console\Input\IO;
22+
use Fidry\Console\IO;
2323
use Humbug\PhpScoper\Configuration\Configuration;
2424
use Humbug\PhpScoper\Configuration\ConfigurationFactory;
2525
use Humbug\PhpScoper\Console\ConfigLoader;
@@ -140,8 +140,8 @@ private function retrieveConfig(IO $io, array $paths, string $cwd): Configuratio
140140

141141
return $configLoader->loadConfig(
142142
$io,
143-
$io->getOption(self::PREFIX_OPT)->asString(),
144-
$io->getOption(self::NO_CONFIG_OPT)->asBoolean(),
143+
$io->getTypedOption(self::PREFIX_OPT)->asString(),
144+
$io->getTypedOption(self::NO_CONFIG_OPT)->asBoolean(),
145145
$this->getConfigFilePath($io, $cwd),
146146
ConfigurationFactory::DEFAULT_FILE_NAME,
147147
false,
@@ -155,7 +155,7 @@ private function retrieveConfig(IO $io, array $paths, string $cwd): Configuratio
155155
*/
156156
private function getConfigFilePath(IO $io, string $cwd): ?string
157157
{
158-
$configFilePath = (string) $io->getOption(self::CONFIG_FILE_OPT)->asNullableString();
158+
$configFilePath = (string) $io->getTypedOption(self::CONFIG_FILE_OPT)->asNullableString();
159159

160160
return '' === $configFilePath ? null : $this->canonicalizePath($configFilePath, $cwd);
161161
}
@@ -166,7 +166,7 @@ private function getConfigFilePath(IO $io, string $cwd): ?string
166166
private function getFilePath(IO $io, string $cwd): string
167167
{
168168
return $this->canonicalizePath(
169-
$io->getArgument(self::FILE_PATH_ARG)->asNonEmptyString(),
169+
$io->getTypedArgument(self::FILE_PATH_ARG)->asNonEmptyString(),
170170
$cwd,
171171
);
172172
}

src/Console/Command/InspectSymbolCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Fidry\Console\Command\CommandRegistry;
1919
use Fidry\Console\Command\Configuration as CommandConfiguration;
2020
use Fidry\Console\ExitCode;
21-
use Fidry\Console\Input\IO;
21+
use Fidry\Console\IO;
2222
use Humbug\PhpScoper\Configuration\Configuration;
2323
use Humbug\PhpScoper\Configuration\ConfigurationFactory;
2424
use Humbug\PhpScoper\Console\ConfigLoader;
@@ -108,7 +108,7 @@ public function execute(IO $io): int
108108
// working directory
109109
$cwd = getcwd();
110110

111-
$symbol = $io->getArgument(self::SYMBOL_ARG)->asString();
111+
$symbol = $io->getTypedArgument(self::SYMBOL_ARG)->asString();
112112
$symbolType = self::getSymbolType($io);
113113
$config = $this->retrieveConfig($io, $cwd);
114114

@@ -130,7 +130,7 @@ public function execute(IO $io): int
130130
// TODO: https://github.com/theofidry/console/issues/99
131131
private static function getSymbolType(IO $io): SymbolType
132132
{
133-
$symbolType = $io->getArgument(self::SYMBOL_TYPE_ARG)->asString();
133+
$symbolType = $io->getTypedArgument(self::SYMBOL_TYPE_ARG)->asString();
134134

135135
return SymbolType::from($symbolType);
136136
}
@@ -144,7 +144,7 @@ private function retrieveConfig(IO $io, string $cwd): Configuration
144144
);
145145

146146
$configFilePath = $this->getConfigFilePath($io, $cwd);
147-
$noConfig = $io->getOption(self::NO_CONFIG_OPT)->asBoolean();
147+
$noConfig = $io->getTypedOption(self::NO_CONFIG_OPT)->asBoolean();
148148

149149
if (null === $configFilePath) {
150150
// Unlike when scoping, we do not want a config file to be created
@@ -175,7 +175,7 @@ private function retrieveConfig(IO $io, string $cwd): Configuration
175175
*/
176176
private function getConfigFilePath(IO $io, string $cwd): ?string
177177
{
178-
$configPath = (string) $io->getOption(self::CONFIG_FILE_OPT)->asNullableString();
178+
$configPath = (string) $io->getTypedOption(self::CONFIG_FILE_OPT)->asNullableString();
179179

180180
if ('' === $configPath) {
181181
$configPath = ConfigurationFactory::DEFAULT_FILE_NAME;

src/Console/ConfigLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Humbug\PhpScoper\Console;
1616

1717
use Fidry\Console\Command\CommandRegistry;
18-
use Fidry\Console\Input\IO;
18+
use Fidry\Console\IO;
1919
use Humbug\PhpScoper\Configuration\Configuration;
2020
use Humbug\PhpScoper\Configuration\ConfigurationFactory;
2121
use Symfony\Component\Console\Exception\RuntimeException;

src/Console/ConsoleScoper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Humbug\PhpScoper\Console;
1616

1717
use Fidry\Console\Application\Application;
18-
use Fidry\Console\Input\IO;
18+
use Fidry\Console\IO;
1919
use Humbug\PhpScoper\Autoload\ComposerFileHasher;
2020
use Humbug\PhpScoper\Autoload\ScoperAutoloadGenerator;
2121
use Humbug\PhpScoper\Configuration\Configuration;

src/Console/ScoperLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Humbug\PhpScoper\Console;
1616

1717
use Fidry\Console\Application\Application as FidryApplication;
18-
use Fidry\Console\Input\IO;
18+
use Fidry\Console\IO;
1919
use Humbug\PhpScoper\Throwable\Exception\ParsingException;
2020
use Symfony\Component\Console\Helper\ProgressBar;
2121
use Symfony\Component\Console\Output\NullOutput;

tests/Console/Command/AddPrefixCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
namespace Humbug\PhpScoper\Console\Command;
1616

17-
use Fidry\Console\Application\SymfonyApplication;
18-
use Fidry\Console\Command\SymfonyCommand;
17+
use Fidry\Console\Bridge\Application\SymfonyApplication;
18+
use Fidry\Console\Bridge\Command\SymfonyCommand;
1919
use Fidry\FileSystem\FS;
2020
use Humbug\PhpScoper\Configuration\ConfigurationFactory;
2121
use Humbug\PhpScoper\Configuration\RegexChecker;

tests/Console/Command/AppIntegrationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
namespace Humbug\PhpScoper\Console\Command;
1616

17-
use Fidry\Console\Application\SymfonyApplication;
18-
use Fidry\Console\Command\SymfonyCommand;
17+
use Fidry\Console\Bridge\Application\SymfonyApplication;
18+
use Fidry\Console\Bridge\Command\SymfonyCommand;
1919
use Humbug\PhpScoper\Configuration\ConfigurationFactory;
2020
use Humbug\PhpScoper\Configuration\RegexChecker;
2121
use Humbug\PhpScoper\Configuration\SymbolsConfigurationFactory;

tests/Console/Command/InspectSymbolCommandIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace Humbug\PhpScoper\Console\Command;
1616

17-
use Fidry\Console\Application\SymfonyApplication;
17+
use Fidry\Console\Bridge\Application\SymfonyApplication;
1818
use Fidry\Console\DisplayNormalizer;
1919
use Humbug\PhpScoper\Console\Application;
2020
use Humbug\PhpScoper\Container;

0 commit comments

Comments
 (0)