2020use Fidry \Console \Command \CommandAwareness ;
2121use Fidry \Console \Command \Configuration as CommandConfiguration ;
2222use Fidry \Console \ExitCode ;
23- use Fidry \Console \IO ;
23+ use Fidry \Console \Input \ IO ;
2424use Humbug \PhpScoper \Configuration \Configuration ;
2525use Humbug \PhpScoper \Configuration \ConfigurationFactory ;
2626use Humbug \PhpScoper \Console \ConfigLoader ;
@@ -92,6 +92,7 @@ public function getConfiguration(): CommandConfiguration
9292 'p ' ,
9393 InputOption::VALUE_REQUIRED ,
9494 'The namespace prefix to add. ' ,
95+ '' ,
9596 ),
9697 new InputOption (
9798 self ::OUTPUT_DIR_OPT ,
@@ -153,7 +154,7 @@ public function execute(IO $io): int
153154 $ config ,
154155 $ paths ,
155156 $ outputDir ,
156- $ io ->getBooleanOption (self ::STOP_ON_FAILURE_OPT ),
157+ $ io ->getOption (self ::STOP_ON_FAILURE_OPT )-> asBoolean ( ),
157158 );
158159
159160 return ExitCode::SUCCESS ;
@@ -165,7 +166,7 @@ public function execute(IO $io): int
165166 private function getOutputDir (IO $ io , string $ cwd ): string
166167 {
167168 return $ this ->canonicalizePath (
168- $ io ->getStringOption (self ::OUTPUT_DIR_OPT ),
169+ $ io ->getOption (self ::OUTPUT_DIR_OPT )-> asString ( ),
169170 $ cwd ,
170171 );
171172 }
@@ -201,7 +202,7 @@ private static function checkPathIsWriteable(string $path): void
201202
202203 private static function canDeleteOutputDir (IO $ io , string $ outputDir ): bool
203204 {
204- if ($ io ->getBooleanOption (self ::FORCE_OPT )) {
205+ if ($ io ->getOption (self ::FORCE_OPT )-> asBoolean ( )) {
205206 return true ;
206207 }
207208
@@ -228,8 +229,8 @@ private function retrieveConfig(IO $io, array $paths, string $cwd): Configuratio
228229
229230 return $ configLoader ->loadConfig (
230231 $ io ,
231- $ io ->getStringOption (self ::PREFIX_OPT ),
232- $ io ->getBooleanOption (self ::NO_CONFIG_OPT ),
232+ $ io ->getOption (self ::PREFIX_OPT )-> asString ( ),
233+ $ io ->getOption (self ::NO_CONFIG_OPT )-> asBoolean ( ),
233234 $ this ->getConfigFilePath ($ io , $ cwd ),
234235 ConfigurationFactory::DEFAULT_FILE_NAME ,
235236 $ this ->init ,
@@ -243,7 +244,7 @@ private function retrieveConfig(IO $io, array $paths, string $cwd): Configuratio
243244 */
244245 private function getConfigFilePath (IO $ io , string $ cwd ): ?string
245246 {
246- $ configFilePath = $ io ->getStringOption (self ::CONFIG_FILE_OPT );
247+ $ configFilePath = ( string ) $ io ->getOption (self ::CONFIG_FILE_OPT )-> asNullableString ( );
247248
248249 return '' === $ configFilePath ? null : $ this ->canonicalizePath ($ configFilePath , $ cwd );
249250 }
@@ -255,7 +256,7 @@ private function getPathArguments(IO $io, string $cwd): array
255256 {
256257 return array_map (
257258 fn (string $ path ) => $ this ->canonicalizePath ($ path , $ cwd ),
258- $ io ->getStringArrayArgument (self ::PATH_ARG ),
259+ $ io ->getArgument (self ::PATH_ARG )-> asNonEmptyStringList ( ),
259260 );
260261 }
261262
0 commit comments