diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-24 04:51:47 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-24 05:02:54 +0900 |
| commit | a8623a5e867825400073d2597dfb3118d6624ef7 (patch) | |
| tree | 7df29f68596765dc3914209e14af4999b721815f /crates/shirabe-external-packages/src/symfony/console/descriptor | |
| parent | e87d37a294a4c754585309d391d793a2c9a1287e (diff) | |
| download | php-shirabe-a8623a5e867825400073d2597dfb3118d6624ef7.tar.gz php-shirabe-a8623a5e867825400073d2597dfb3118d6624ef7.tar.zst php-shirabe-a8623a5e867825400073d2597dfb3118d6624ef7.zip | |
chore: unwrap meaningless PhpMixed::String()
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/descriptor')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/descriptor/markdown_descriptor.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/descriptor/text_descriptor.rs | 59 |
2 files changed, 25 insertions, 46 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/descriptor/markdown_descriptor.rs b/crates/shirabe-external-packages/src/symfony/console/descriptor/markdown_descriptor.rs index 26efd4c..12afd53 100644 --- a/crates/shirabe-external-packages/src/symfony/console/descriptor/markdown_descriptor.rs +++ b/crates/shirabe-external-packages/src/symfony/console/descriptor/markdown_descriptor.rs @@ -262,8 +262,8 @@ impl MarkdownDescriptor { .map(|command_name| { Ok(format!( "* [`{}`](#{})", - PhpMixed::String(command_name.clone()), - PhpMixed::String(shirabe_php_shim::str_replace( + command_name.clone(), + shirabe_php_shim::str_replace( ":", "", &description @@ -271,7 +271,7 @@ impl MarkdownDescriptor { .borrow() .get_name() .unwrap_or_default(), - )), + ), )) }) .collect::<anyhow::Result<Vec<String>>>()? @@ -292,11 +292,7 @@ impl MarkdownDescriptor { fn get_application_title(&self, application: &dyn Application) -> String { if "UNKNOWN" != application.get_name() { if "UNKNOWN" != application.get_version() { - return format!( - "{} {}", - PhpMixed::String(application.get_name()), - PhpMixed::String(application.get_version()), - ); + return format!("{} {}", application.get_name(), application.get_version()); } return application.get_name(); diff --git a/crates/shirabe-external-packages/src/symfony/console/descriptor/text_descriptor.rs b/crates/shirabe-external-packages/src/symfony/console/descriptor/text_descriptor.rs index afb7ca8..4961bd8 100644 --- a/crates/shirabe-external-packages/src/symfony/console/descriptor/text_descriptor.rs +++ b/crates/shirabe-external-packages/src/symfony/console/descriptor/text_descriptor.rs @@ -62,18 +62,18 @@ impl TextDescriptor { self.write_text( &format!( " <info>{}</info> {}{}{}", - PhpMixed::String(argument.get_name().to_string()), - PhpMixed::String(shirabe_php_shim::str_repeat(" ", spacing_width as usize)), + argument.get_name().to_string(), + shirabe_php_shim::str_repeat(" ", spacing_width as usize), // + 4 = 2 spaces before <info>, 2 spaces after </info> - PhpMixed::String(Preg::replace( + Preg::replace( "/\\s*[\\r\\n]\\s*/", &format!( "\n{}", shirabe_php_shim::str_repeat(" ", (total_width + 4) as usize) ), argument.get_description(), - )), - PhpMixed::String(default), + ), + default, ), &options, ); @@ -114,24 +114,14 @@ impl TextDescriptor { let synopsis = format!( "{}{}", if option.get_shortcut().is_some() { - format!( - "-{}, ", - PhpMixed::String(option.get_shortcut().unwrap().to_string()), - ) + format!("-{}, ", option.get_shortcut().unwrap().to_string()) } else { " ".to_string() }, if option.is_negatable() { - format!( - "--{0}|--no-{0}", - PhpMixed::String(option.get_name().to_string()), - ) + format!("--{0}|--no-{0}", option.get_name().to_string()) } else { - format!( - "--{0}{1}", - PhpMixed::String(option.get_name().to_string()), - PhpMixed::String(value.clone()), - ) + format!("--{0}{1}", option.get_name().to_string(), value.clone()) } ); @@ -140,23 +130,23 @@ impl TextDescriptor { self.write_text( &format!( " <info>{}</info> {}{}{}{}", - PhpMixed::String(synopsis), - PhpMixed::String(shirabe_php_shim::str_repeat(" ", spacing_width as usize)), + synopsis, + shirabe_php_shim::str_repeat(" ", spacing_width as usize), // + 4 = 2 spaces before <info>, 2 spaces after </info> - PhpMixed::String(Preg::replace( + Preg::replace( "/\\s*[\\r\\n]\\s*/", &format!( "\n{}", shirabe_php_shim::str_repeat(" ", (total_width + 4) as usize) ), option.get_description(), - )), - PhpMixed::String(default), - PhpMixed::String(if option.is_array() { + ), + default, + if option.is_array() { "<comment> (multiple values allowed)</comment>".to_string() } else { String::new() - }), + }, ), &options, ); @@ -291,8 +281,8 @@ impl TextDescriptor { self.write_text( &format!( "{:<w$} {}", - PhpMixed::String(command.get_name().unwrap_or_default()), - PhpMixed::String(command.get_description()), + command.get_name().unwrap_or_default(), + command.get_description(), w = width as usize, ), &options, @@ -360,7 +350,7 @@ impl TextDescriptor { self.write_text( &format!( "<comment>Available commands for the \"{}\" namespace:</comment>", - PhpMixed::String(described_namespace.clone()), + described_namespace.clone(), ), &options, ); @@ -411,16 +401,9 @@ impl TextDescriptor { self.write_text( &format!( " <info>{}</info>{}{}", - PhpMixed::String(name.clone()), - PhpMixed::String(shirabe_php_shim::str_repeat( - " ", - spacing_width as usize, - )), - PhpMixed::String(format!( - "{}{}", - command_aliases, - command.get_description() - )), + name.clone(), + shirabe_php_shim::str_repeat(" ", spacing_width as usize), + format!("{}{}", command_aliases, command.get_description()), ), &options, ); |
