diff options
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console')
24 files changed, 166 insertions, 263 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/color.rs b/crates/shirabe-external-packages/src/symfony/console/color.rs index 2988e84..3d5a7c4 100644 --- a/crates/shirabe-external-packages/src/symfony/console/color.rs +++ b/crates/shirabe-external-packages/src/symfony/console/color.rs @@ -155,7 +155,7 @@ impl Color { if shirabe_php_shim::strlen(&color) != 6 { return Err(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!("Invalid \"{}\" color.", color.clone(),), + message: format!("Invalid \"{}\" color.", color.clone()), code: 0, }, )); diff --git a/crates/shirabe-external-packages/src/symfony/console/cursor.rs b/crates/shirabe-external-packages/src/symfony/console/cursor.rs index c36f9b5..05439df 100644 --- a/crates/shirabe-external-packages/src/symfony/console/cursor.rs +++ b/crates/shirabe-external-packages/src/symfony/console/cursor.rs @@ -23,7 +23,7 @@ impl Cursor { pub fn move_up(&self, lines: i64) -> &Self { self.output.borrow().write( - &[format!("\x1b[{}A", shirabe_php_shim::PhpMixed::Int(lines),)], + &[format!("\x1b[{}A", lines)], false, output_interface::OUTPUT_NORMAL, ); @@ -33,7 +33,7 @@ impl Cursor { pub fn move_down(&self, lines: i64) -> &Self { self.output.borrow().write( - &[format!("\x1b[{}B", shirabe_php_shim::PhpMixed::Int(lines),)], + &[format!("\x1b[{}B", lines)], false, output_interface::OUTPUT_NORMAL, ); @@ -43,10 +43,7 @@ impl Cursor { pub fn move_right(&self, columns: i64) -> &Self { self.output.borrow().write( - &[format!( - "\x1b[{}C", - shirabe_php_shim::PhpMixed::Int(columns), - )], + &[format!("\x1b[{}C", columns)], false, output_interface::OUTPUT_NORMAL, ); @@ -56,10 +53,7 @@ impl Cursor { pub fn move_left(&self, columns: i64) -> &Self { self.output.borrow().write( - &[format!( - "\x1b[{}D", - shirabe_php_shim::PhpMixed::Int(columns), - )], + &[format!("\x1b[{}D", columns)], false, output_interface::OUTPUT_NORMAL, ); @@ -69,7 +63,7 @@ impl Cursor { pub fn move_to_column(&self, column: i64) -> &Self { self.output.borrow().write( - &[format!("\x1b[{}G", shirabe_php_shim::PhpMixed::Int(column),)], + &[format!("\x1b[{}G", column)], false, output_interface::OUTPUT_NORMAL, ); @@ -79,11 +73,7 @@ impl Cursor { pub fn move_to_position(&self, column: i64, row: i64) -> &Self { self.output.borrow().write( - &[format!( - "\x1b[{};{}H", - shirabe_php_shim::PhpMixed::Int(row + 1), - shirabe_php_shim::PhpMixed::Int(column), - )], + &[format!("\x1b[{};{}H", row + 1, column)], false, output_interface::OUTPUT_NORMAL, ); @@ -216,10 +206,7 @@ impl Cursor { None, ); - shirabe_php_shim::shell_exec(&format!( - "stty {}", - shirabe_php_shim::PhpMixed::String(stty_mode.unwrap_or_default(),), - )); + shirabe_php_shim::shell_exec(&format!("stty {}", stty_mode.unwrap_or_default())); let mut row: i64 = 0; let mut col: i64 = 0; 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, ); diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs index 78c86f1..d528b4a 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs @@ -55,9 +55,9 @@ impl DebugFormatterHelper { format!( "{}<bg=blue;fg=white> {} </> <fg=blue>{}</>\n", - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(prefix.to_string()), - shirabe_php_shim::PhpMixed::String(message.to_string()), + self.get_border(id), + prefix.to_string(), + message.to_string(), ) } @@ -80,8 +80,8 @@ impl DebugFormatterHelper { if !self.started[id].err { message.push_str(&format!( "{}<bg=red;fg=white> {} </> ", - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(error_prefix.to_string()), + self.get_border(id), + error_prefix.to_string(), )); self.started.get_mut(id).unwrap().err = true; } @@ -90,8 +90,8 @@ impl DebugFormatterHelper { "\n", &format!( "\n{}<bg=red;fg=white> {} </> ", - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(error_prefix.to_string()), + self.get_border(id), + error_prefix.to_string(), ), buffer, )); @@ -103,8 +103,8 @@ impl DebugFormatterHelper { if !self.started[id].out { message.push_str(&format!( "{}<bg=green;fg=white> {} </> ", - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(prefix.to_string()), + self.get_border(id), + prefix.to_string(), )); self.started.get_mut(id).unwrap().out = true; } @@ -113,8 +113,8 @@ impl DebugFormatterHelper { "\n", &format!( "\n{}<bg=green;fg=white> {} </> ", - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(prefix.to_string()), + self.get_border(id), + prefix.to_string(), ), buffer, )); @@ -134,19 +134,19 @@ impl DebugFormatterHelper { if successful { return format!( "{}{}<bg=green;fg=white> {} </> <fg=green>{}</>\n", - shirabe_php_shim::PhpMixed::String(trailing_eol.to_string()), - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(prefix.to_string()), - shirabe_php_shim::PhpMixed::String(message.to_string()), + trailing_eol.to_string(), + self.get_border(id), + prefix.to_string(), + message.to_string(), ); } let message = format!( "{}{}<bg=red;fg=white> {} </> <fg=red>{}</>\n", - shirabe_php_shim::PhpMixed::String(trailing_eol.to_string()), - shirabe_php_shim::PhpMixed::String(self.get_border(id)), - shirabe_php_shim::PhpMixed::String(prefix.to_string()), - shirabe_php_shim::PhpMixed::String(message.to_string()), + trailing_eol.to_string(), + self.get_border(id), + prefix.to_string(), + message.to_string(), ); if let Some(session) = self.started.get_mut(id) { @@ -160,9 +160,7 @@ impl DebugFormatterHelper { fn get_border(&self, id: &str) -> String { format!( "<bg={}> </>", - shirabe_php_shim::PhpMixed::String( - COLORS[self.started[id].border as usize].to_string(), - ), + COLORS[self.started[id].border as usize].to_string(), ) } } diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs index 521284b..83e946c 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs @@ -83,10 +83,7 @@ impl DescriptorHelper { if !self.descriptors.contains_key(&format) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "Unsupported format \"{}\".", - shirabe_php_shim::PhpMixed::String(format.clone()), - ), + message: format!("Unsupported format \"{}\".", format.clone()), code: 0, }) .into(), diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs index f27fa29..8a6c97f 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs @@ -18,10 +18,10 @@ impl FormatterHelper { pub fn format_section(&self, section: &str, message: &str, style: &str) -> String { format!( "<{}>[{}]</{}> {}", - shirabe_php_shim::PhpMixed::String(style.to_string()), - shirabe_php_shim::PhpMixed::String(section.to_string()), - shirabe_php_shim::PhpMixed::String(style.to_string()), - shirabe_php_shim::PhpMixed::String(message.to_string()), + style.to_string(), + section.to_string(), + style.to_string(), + message.to_string(), ) } @@ -68,9 +68,9 @@ impl FormatterHelper { while i < messages.len() { messages[i] = format!( "<{}>{}</{}>", - shirabe_php_shim::PhpMixed::String(style.to_string()), - shirabe_php_shim::PhpMixed::String(messages[i].clone()), - shirabe_php_shim::PhpMixed::String(style.to_string()), + style.to_string(), + messages[i].clone(), + style.to_string(), ); i += 1; } diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs index de72b2e..6425659 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs @@ -111,18 +111,18 @@ impl Helper { pub fn format_memory(memory: i64) -> String { if memory >= 1024 * 1024 * 1024 { - return format!("{:.1} GiB", memory as f64 / 1024.0 / 1024.0 / 1024.0,); + return format!("{:.1} GiB", memory as f64 / 1024.0 / 1024.0 / 1024.0); } if memory >= 1024 * 1024 { - return format!("{:.1} MiB", memory as f64 / 1024.0 / 1024.0,); + return format!("{:.1} MiB", memory as f64 / 1024.0 / 1024.0); } if memory >= 1024 { - return format!("{} KiB", shirabe_php_shim::PhpMixed::Int(memory / 1024),); + return format!("{} KiB", memory / 1024); } - format!("{} B", shirabe_php_shim::PhpMixed::Int(memory)) + format!("{} B", memory) } /// @deprecated since Symfony 5.3 diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs index f141bee..c59eed0 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs @@ -174,10 +174,7 @@ impl ProcessHelper { && let Some(error) = error { output.borrow().writeln( - &[format!( - "<error>{}</error>", - shirabe_php_shim::PhpMixed::String(self.escape_string(error),), - )], + &[format!("<error>{}</error>", self.escape_string(error))], output_interface::OUTPUT_NORMAL, ); } diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs index 1cd50ac..ab97d2e 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs @@ -816,7 +816,7 @@ impl ProgressBar { shirabe_php_shim::PhpMixed::String(s) => s, shirabe_php_shim::PhpMixed::Int(i) => i.to_string(), shirabe_php_shim::PhpMixed::Float(f) => { - format!("{}", shirabe_php_shim::PhpMixed::Float(f)) + format!("{}", f) } other => format!("{}", other), }) diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs index 2bdd929..281069e 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs @@ -302,7 +302,7 @@ impl QuestionHelper { messages.push(format!( " [<{tag}>{}{padding}</{tag}>] {}", - PhpMixed::String(key.clone()), + key.clone(), value.clone(), )); } diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs index 9940896..ea7a322 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs @@ -32,27 +32,22 @@ impl SymfonyQuestionHelper { let default = question.get_default(); if question.is_multiline() { - text += &format!( - " (press {} to continue)", - PhpMixed::String(self.get_eof_shortcut()), - ); + text += &format!(" (press {} to continue)", self.get_eof_shortcut()); } // switch (true) if matches!(default, PhpMixed::Null) { - text = format!(" <info>{}</info>:", PhpMixed::String(text)); + text = format!(" <info>{}</info>:", text); } else if question.as_confirmation().is_some() { text = format!( " <info>{} (yes/no)</info> [<comment>{}</comment>]:", - PhpMixed::String(text), - PhpMixed::String( - if shirabe_php_shim::boolval(&default) { - "yes" - } else { - "no" - } - .to_string(), - ), + text, + if shirabe_php_shim::boolval(&default) { + "yes" + } else { + "no" + } + .to_string(), ); } else if let Some(choice_question) = question.as_choice().filter(|q| q.is_multiselect()) { let choices = choice_question.get_choices(); @@ -70,30 +65,28 @@ impl SymfonyQuestionHelper { text = format!( " <info>{}</info> [<comment>{}</comment>]:", - PhpMixed::String(text), - PhpMixed::String(OutputFormatter::escape(&resolved.join(", ")).unwrap()), + text, + OutputFormatter::escape(&resolved.join(", ")).unwrap(), ); } else if let Some(choice_question) = question.as_choice() { let choices = choice_question.get_choices(); text = format!( " <info>{}</info> [<comment>{}</comment>]:", - PhpMixed::String(text), - PhpMixed::String( - OutputFormatter::escape( - &choices - .get(&default.to_string()) - .cloned() - .unwrap_or(default.clone()) - .to_string(), - ) - .unwrap(), - ), + text, + OutputFormatter::escape( + &choices + .get(&default.to_string()) + .cloned() + .unwrap_or(default.clone()) + .to_string(), + ) + .unwrap(), ); } else { text = format!( " <info>{}</info> [<comment>{}</comment>]:", - PhpMixed::String(text), - PhpMixed::String(OutputFormatter::escape(&default.to_string()).unwrap()), + text, + OutputFormatter::escape(&default.to_string()).unwrap(), ); } diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs index 27b07aa..1167d63 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs @@ -121,7 +121,7 @@ impl Table { Ok(Err(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!("Style \"{}\" is not defined.", PhpMixed::from(name),), + message: format!("Style \"{}\" is not defined.", name), code: 0, }, ))) @@ -272,8 +272,8 @@ impl Table { return Ok(Err(RuntimeException(shirabe_php_shim::RuntimeException { message: format!( "Output should be an instance of \"{}\" when calling \"{}\".", - PhpMixed::from("Symfony\\Component\\Console\\Output\\ConsoleSectionOutput"), - PhpMixed::from("Symfony\\Component\\Console\\Helper\\Table::appendRow"), + "Symfony\\Component\\Console\\Output\\ConsoleSectionOutput", + "Symfony\\Component\\Console\\Helper\\Table::appendRow", ), code: 0, }))); @@ -1234,7 +1234,7 @@ impl Table { Ok(Err(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!("Style \"{}\" is not defined.", PhpMixed::from(name_str),), + message: format!("Style \"{}\" is not defined.", name_str), code: 0, }, ))) diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs index a967d0e..b85b7d1 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs @@ -40,7 +40,7 @@ impl TableCell { shirabe_php_shim::InvalidArgumentException { message: format!( "The TableCell does not support the following options: '{}'.", - shirabe_php_shim::PhpMixed::String(diff.join("', '")), + diff.join("', '"), ), code: 0, }, diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell_style.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell_style.rs index 68600e7..d5eabf5 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell_style.rs @@ -56,7 +56,7 @@ impl TableCellStyle { shirabe_php_shim::InvalidArgumentException { message: format!( "The TableCellStyle does not support the following options: '{}'.", - shirabe_php_shim::PhpMixed::String(diff.join("', '")), + diff.join("', '"), ), code: 0, }, @@ -73,7 +73,7 @@ impl TableCellStyle { shirabe_php_shim::InvalidArgumentException { message: format!( "Wrong align value. Value must be following: '{}'.", - shirabe_php_shim::PhpMixed::String(align_map_keys().join("', '"),), + align_map_keys().join("', '"), ), code: 0, }, diff --git a/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs index 875d217..54a5f3a 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/argv_input.rs @@ -154,7 +154,7 @@ impl ArgvInput { } }; return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!("The \"-{}\" option does not exist.", PhpMixed::String(bad),), + message: format!("The \"-{}\" option does not exist.", bad), code: 0, }) .into()); @@ -254,12 +254,12 @@ impl ArgvInput { format!( "Too many arguments to \"{}\" command, expected arguments \"{}\".", symfony_command_name.clone(), - PhpMixed::String(shirabe_php_shim::implode("\" \"", &names)), + shirabe_php_shim::implode("\" \"", &names), ) } _ => format!( "Too many arguments, expected arguments \"{}\".", - PhpMixed::String(shirabe_php_shim::implode("\" \"", &names)), + shirabe_php_shim::implode("\" \"", &names), ), } } else if symfony_command_name @@ -270,13 +270,10 @@ impl ArgvInput { format!( "No arguments expected for \"{}\" command, got \"{}\".", symfony_command_name.clone().unwrap(), - PhpMixed::String(token.to_string()), + token.to_string(), ) } else { - format!( - "No arguments expected, got \"{}\".", - PhpMixed::String(token.to_string()), - ) + format!("No arguments expected, got \"{}\".", token.to_string()) }; return Err( @@ -291,10 +288,7 @@ impl ArgvInput { fn add_short_option(&mut self, shortcut: &str, value: PhpMixed) -> anyhow::Result<()> { if !self.inner.definition.has_shortcut(shortcut) { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!( - "The \"-{}\" option does not exist.", - PhpMixed::String(shortcut.to_string()), - ), + message: format!("The \"-{}\" option does not exist.", shortcut.to_string()), code: 0, }) .into()); @@ -314,10 +308,7 @@ impl ArgvInput { if !self.inner.definition.has_option(name) { if !self.inner.definition.has_negation(name) { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!( - "The \"--{}\" option does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"--{}\" option does not exist.", name.to_string()), code: 0, }) .into()); @@ -328,7 +319,7 @@ impl ArgvInput { return Err(RuntimeException(shirabe_php_shim::RuntimeException { message: format!( "The \"--{}\" option does not accept a value.", - PhpMixed::String(name.to_string()), + name.to_string(), ), code: 0, }) @@ -347,7 +338,7 @@ impl ArgvInput { return Err(RuntimeException(shirabe_php_shim::RuntimeException { message: format!( "The \"--{}\" option does not accept a value.", - PhpMixed::String(name.to_string()), + name.to_string(), ), code: 0, }) @@ -373,10 +364,7 @@ impl ArgvInput { if matches!(value, PhpMixed::Null) { if option.is_value_required() { return Err(RuntimeException(shirabe_php_shim::RuntimeException { - message: format!( - "The \"--{}\" option requires a value.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"--{}\" option requires a value.", name.to_string()), code: 0, }) .into()); diff --git a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs index 327650b..384bc6d 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs @@ -216,10 +216,7 @@ impl ArrayInput { if !self.inner.definition.has_shortcut(shortcut) { return Err(InvalidOptionException(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"-{}\" option does not exist.", - PhpMixed::String(shortcut.to_string()), - ), + message: format!("The \"-{}\" option does not exist.", shortcut.to_string()), code: 0, }, )) @@ -241,10 +238,7 @@ impl ArrayInput { if !self.inner.definition.has_negation(name) { return Err(InvalidOptionException(InvalidArgumentException( shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"--{}\" option does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"--{}\" option does not exist.", name.to_string()), code: 0, }, )) @@ -263,16 +257,18 @@ impl ArrayInput { if matches!(value, PhpMixed::Null) { if option.is_value_required() { - return Err(InvalidOptionException(InvalidArgumentException( - shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"--{}\" option requires a value.", - PhpMixed::String(name.to_string()), - ), - code: 0, - }, - )) - .into()); + return Err( + InvalidOptionException(InvalidArgumentException( + shirabe_php_shim::InvalidArgumentException { + message: format!( + "The \"--{}\" option requires a value.", + name.to_string(), + ), + code: 0, + }, + )) + .into(), + ); } if !option.is_value_optional() { @@ -290,7 +286,7 @@ impl ArrayInput { if !self.inner.definition.has_argument(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"{}\" argument does not exist.", name.clone(),), + message: format!("The \"{}\" argument does not exist.", name.clone()), code: 0, }) .into(), diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input.rs b/crates/shirabe-external-packages/src/symfony/console/input/input.rs index d365f8d..5e5a12b 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/input.rs @@ -83,7 +83,7 @@ impl Input { return Err(RuntimeException(shirabe_php_shim::RuntimeException { message: format!( "Not enough arguments (missing: \"{}\").", - PhpMixed::String(shirabe_php_shim::implode(", ", &missing_arguments,)), + shirabe_php_shim::implode(", ", &missing_arguments), ), code: 0, }) @@ -115,10 +115,7 @@ impl Input { { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"{}\" argument does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"{}\" argument does not exist.", name.to_string()), code: 0, }) .into(), @@ -142,10 +139,7 @@ impl Input { { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"{}\" argument does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"{}\" argument does not exist.", name.to_string()), code: 0, }) .into(), @@ -182,10 +176,7 @@ impl Input { if !self.definition.has_option(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"{}\" option does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"{}\" option does not exist.", name.to_string()), code: 0, }) .into(), @@ -209,10 +200,7 @@ impl Input { } else if !self.definition.has_option(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"{}\" option does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"{}\" option does not exist.", name.to_string()), code: 0, }) .into(), diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs index 911e287..56f685c 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs @@ -114,7 +114,7 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "An argument with name \"{}\" already exists.", - PhpMixed::String(argument.get_name().to_string()), + argument.get_name().to_string(), ), code: 0, }) @@ -125,8 +125,8 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "Cannot add a required argument \"{}\" after an array argument \"{}\".", - PhpMixed::String(argument.get_name().to_string()), - PhpMixed::String(last_array_argument.get_name().to_string()), + argument.get_name().to_string(), + last_array_argument.get_name().to_string(), ), code: 0, }) @@ -139,8 +139,8 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "Cannot add a required argument \"{}\" after an optional one \"{}\".", - PhpMixed::String(argument.get_name().to_string()), - PhpMixed::String(last_optional_argument.get_name().to_string()), + argument.get_name().to_string(), + last_optional_argument.get_name().to_string(), ), code: 0, }) @@ -168,7 +168,7 @@ impl InputDefinition { if !self.has_argument(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!("The \"{}\" argument does not exist.", name.clone(),), + message: format!("The \"{}\" argument does not exist.", name.clone()), code: 0, }) .into(), @@ -262,7 +262,7 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "An option named \"{}\" already exists.", - PhpMixed::String(option.get_name().to_string()), + option.get_name().to_string(), ), code: 0, }) @@ -272,7 +272,7 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "An option named \"{}\" already exists.", - PhpMixed::String(option.get_name().to_string()), + option.get_name().to_string(), ), code: 0, }) @@ -287,7 +287,7 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "An option with shortcut \"{}\" already exists.", - PhpMixed::String(shortcut.clone()), + shortcut.clone(), ), code: 0, }) @@ -311,7 +311,7 @@ impl InputDefinition { return Err(LogicException(shirabe_php_shim::LogicException { message: format!( "An option named \"{}\" already exists.", - PhpMixed::String(negated_name.clone()), + negated_name.clone(), ), code: 0, }) @@ -329,10 +329,7 @@ impl InputDefinition { if !self.has_option(name) { return Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"--{}\" option does not exist.", - PhpMixed::String(name.to_string()), - ), + message: format!("The \"--{}\" option does not exist.", name.to_string()), code: 0, }) .into(), @@ -384,10 +381,7 @@ impl InputDefinition { match self.shortcuts.get(shortcut) { None => Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"-{}\" option does not exist.", - PhpMixed::String(shortcut.to_string()), - ), + message: format!("The \"-{}\" option does not exist.", shortcut.to_string()), code: 0, }) .into(), @@ -401,10 +395,7 @@ impl InputDefinition { match self.negations.get(negation) { None => Err( InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { - message: format!( - "The \"--{}\" option does not exist.", - PhpMixed::String(negation.to_string()), - ), + message: format!("The \"--{}\" option does not exist.", negation.to_string()), code: 0, }) .into(), @@ -425,37 +416,37 @@ impl InputDefinition { if option.accept_value() { value = format!( " {}{}{}", - PhpMixed::String(if option.is_value_optional() { + if option.is_value_optional() { "[".to_string() } else { String::new() - }), - PhpMixed::String(shirabe_php_shim::strtoupper(option.get_name())), - PhpMixed::String(if option.is_value_optional() { + }, + shirabe_php_shim::strtoupper(option.get_name()), + if option.is_value_optional() { "]".to_string() } else { String::new() - }), + }, ); } let shortcut = match option.get_shortcut() { Some(shortcut) => { - format!("-{}|", PhpMixed::String(shortcut.to_string())) + format!("-{}|", shortcut.to_string()) } None => String::new(), }; let negation = if option.is_negatable() { - format!("|--no-{}", PhpMixed::String(option.get_name().to_string()),) + format!("|--no-{}", option.get_name().to_string()) } else { String::new() }; elements.push(format!( "[{}--{}{}{}]", - PhpMixed::String(shortcut), - PhpMixed::String(option.get_name().to_string()), - PhpMixed::String(value), - PhpMixed::String(negation), + shortcut, + option.get_name().to_string(), + value, + negation, )); } } diff --git a/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs index c3a0262..747ac0e 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs @@ -125,7 +125,7 @@ impl StringInput { InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { message: format!( "Unable to parse input near \"... {} ...\".", - PhpMixed::String(shirabe_php_shim::substr(input, cursor, Some(10),)), + shirabe_php_shim::substr(input, cursor, Some(10)), ), code: 0, }) diff --git a/crates/shirabe-external-packages/src/symfony/console/output/console_section_output.rs b/crates/shirabe-external-packages/src/symfony/console/output/console_section_output.rs index 3120775..3f469fc 100644 --- a/crates/shirabe-external-packages/src/symfony/console/output/console_section_output.rs +++ b/crates/shirabe-external-packages/src/symfony/console/output/console_section_output.rs @@ -129,13 +129,8 @@ impl ConsoleSectionOutput { if number_of_lines_to_clear > 0 { // move cursor up n lines - self.inner.do_write( - &format!( - "\x1b[{}A", - shirabe_php_shim::PhpMixed::Int(number_of_lines_to_clear), - ), - false, - ); + self.inner + .do_write(&format!("\x1b[{}A", number_of_lines_to_clear), false); // erase to end of screen self.inner.do_write("\x1b[0J", false); } diff --git a/crates/shirabe-external-packages/src/symfony/console/output/trimmed_buffer_output.rs b/crates/shirabe-external-packages/src/symfony/console/output/trimmed_buffer_output.rs index be58a8d..6c405a0 100644 --- a/crates/shirabe-external-packages/src/symfony/console/output/trimmed_buffer_output.rs +++ b/crates/shirabe-external-packages/src/symfony/console/output/trimmed_buffer_output.rs @@ -25,11 +25,9 @@ impl TrimmedBufferOutput { shirabe_php_shim::InvalidArgumentException { message: format!( "\"{}()\" expects a strictly positive maxLength. Got {}.", - shirabe_php_shim::PhpMixed::String( - "Symfony\\Component\\Console\\Output\\TrimmedBufferOutput::__construct" - .to_string(), - ), - shirabe_php_shim::PhpMixed::Int(max_length), + "Symfony\\Component\\Console\\Output\\TrimmedBufferOutput::__construct" + .to_string(), + max_length, ), code: 0, }, diff --git a/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs b/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs index b862eb8..6c44966 100644 --- a/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs +++ b/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs @@ -172,7 +172,7 @@ impl ChoiceQuestion { shirabe_php_shim::InvalidArgumentException { message: format!( "The provided answer is ambiguous. Value should be one of \"{}\".", - PhpMixed::String(shirabe_php_shim::implode("\" or \"", &results,)), + shirabe_php_shim::implode("\" or \"", &results), ), code: 0, }, diff --git a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs index f445877..92e80b2 100644 --- a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs @@ -353,7 +353,7 @@ impl SymfonyStyle { let mut r#type = r#type.map(|t| t.to_string()); let mut line_indentation = String::new(); if let Some(t) = &r#type { - let formatted = format!("[{}] ", PhpMixed::String(t.clone())); + let formatted = format!("[{}] ", t.clone()); indent_length = shirabe_php_shim::strlen(&formatted); line_indentation = shirabe_php_shim::str_repeat(" ", indent_length as usize); r#type = Some(formatted); @@ -424,11 +424,7 @@ impl SymfonyStyle { )); if let Some(style) = style { - *line = format!( - "<{}>{}</>", - PhpMixed::String(style.to_string()), - PhpMixed::String(line.clone()), - ); + *line = format!("<{}>{}</>", style.to_string(), line.clone()); } } @@ -521,17 +517,17 @@ impl StyleInterface for SymfonyStyle { PhpMixed::List(vec![ PhpMixed::String(format!( "<comment>{}</>", - PhpMixed::String(OutputFormatter::escape_trailing_backslash(message),), + OutputFormatter::escape_trailing_backslash(message), )), PhpMixed::String(format!( "<comment>{}</>", - PhpMixed::String(shirabe_php_shim::str_repeat( + shirabe_php_shim::str_repeat( "=", Helper::width(&Helper::remove_decoration( &mut *self.get_formatter().borrow_mut(), message, )) as usize, - )), + ), )), ]), OUTPUT_NORMAL, @@ -546,17 +542,17 @@ impl StyleInterface for SymfonyStyle { PhpMixed::List(vec![ PhpMixed::String(format!( "<comment>{}</>", - PhpMixed::String(OutputFormatter::escape_trailing_backslash(message),), + OutputFormatter::escape_trailing_backslash(message), )), PhpMixed::String(format!( "<comment>{}</>", - PhpMixed::String(shirabe_php_shim::str_repeat( + shirabe_php_shim::str_repeat( "-", Helper::width(&Helper::remove_decoration( &mut *self.get_formatter().borrow_mut(), message, )) as usize, - )), + ), )), ]), OUTPUT_NORMAL, |
