diff options
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/helper')
11 files changed, 64 insertions, 79 deletions
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, }, |
