From a8623a5e867825400073d2597dfb3118d6624ef7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 24 Jun 2026 04:51:47 +0900 Subject: chore: unwrap meaningless PhpMixed::String() --- .../console/descriptor/markdown_descriptor.rs | 12 ++--- .../symfony/console/descriptor/text_descriptor.rs | 59 ++++++++-------------- 2 files changed, 25 insertions(+), 46 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/descriptor') 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::>>()? @@ -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!( " {} {}{}{}", - 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 , 2 spaces after - 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!( " {} {}{}{}{}", - 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 , 2 spaces after - 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() { " (multiple values allowed)".to_string() } else { String::new() - }), + }, ), &options, ); @@ -291,8 +281,8 @@ impl TextDescriptor { self.write_text( &format!( "{:Available commands for the \"{}\" namespace:", - PhpMixed::String(described_namespace.clone()), + described_namespace.clone(), ), &options, ); @@ -411,16 +401,9 @@ impl TextDescriptor { self.write_text( &format!( " {}{}{}", - 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, ); -- cgit v1.3.1