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 | |
| 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')
54 files changed, 363 insertions, 521 deletions
diff --git a/crates/shirabe-class-map-generator/src/class_map_generator.rs b/crates/shirabe-class-map-generator/src/class_map_generator.rs index 2963b29..5359f12 100644 --- a/crates/shirabe-class-map-generator/src/class_map_generator.rs +++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs @@ -28,8 +28,7 @@ impl ClassMapGenerator { .iter() .map(|w| preg_quote(w, None)) .collect(); - let stream_wrappers_regex = - format!("{{^(?:{})://}}", PhpMixed::String(implode("|", &wrappers))); + let stream_wrappers_regex = format!("{{^(?:{})://}}", implode("|", &wrappers)); ClassMapGenerator { extensions, 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, diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs index 411e83e..ca49591 100644 --- a/crates/shirabe/src/advisory/auditor.rs +++ b/crates/shirabe/src/advisory/auditor.rs @@ -537,12 +537,12 @@ impl Auditor { ) -> Result<()> { io.write_error(&format!( "<error>Found {} abandoned package{}:</error>", - PhpMixed::Int(packages.len() as i64), - PhpMixed::String(if packages.len() > 1 { + packages.len() as i64, + if packages.len() > 1 { "s".to_string() } else { String::new() - }), + }, )); if format == Self::FORMAT_PLAIN { @@ -554,8 +554,8 @@ impl Auditor { }; io.write_error(&format!( "{} is abandoned. {}.", - PhpMixed::String(self.get_package_name_with_link(pkg.clone().into())), - PhpMixed::String(replacement), + self.get_package_name_with_link(pkg.clone().into()), + replacement, )); } diff --git a/crates/shirabe/src/cache.rs b/crates/shirabe/src/cache.rs index 8d9473a..696378a 100644 --- a/crates/shirabe/src/cache.rs +++ b/crates/shirabe/src/cache.rs @@ -125,7 +125,7 @@ impl Cache { self.io .write_error(&format!("Writing {}{} into cache", self.root, file)); - let temp_file_name = format!("{}{}{}.tmp", self.root, file, bin2hex(&random_bytes(5)),); + let temp_file_name = format!("{}{}{}.tmp", self.root, file, bin2hex(&random_bytes(5))); let dest = format!("{}{}", self.root, file); let attempt = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { file_put_contents(&temp_file_name, contents.as_bytes()).is_some() diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs index caa9808..db91012 100644 --- a/crates/shirabe/src/command/exec_command.rs +++ b/crates/shirabe/src/command/exec_command.rs @@ -90,11 +90,11 @@ impl Command for ExecCommand { InputArgument::new("binary", Some(InputArgument::OPTIONAL), "The binary to run, e.g. phpunit", - None,).unwrap().into(), + None).unwrap().into(), InputArgument::new("args", Some(InputArgument::IS_ARRAY | InputArgument::OPTIONAL), "Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments", - None,).unwrap().into(), + None).unwrap().into(), ]); self.set_help( "Executes a vendored binary/script.\n\n\ diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index ec9ede4..d98793a 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -888,7 +888,7 @@ impl Command for InitCommand { return Err(InvalidArgumentException { message: format!( "The src folder name \"{}\" is invalid. Please add a relative path with tailing forward slash. [A-Za-z0-9_-/]+/", - PhpMixed::String(value_or_default.clone()), + value_or_default.clone(), ), code: 0, } @@ -1049,10 +1049,7 @@ impl InitCommand { return false; } - let pattern = format!( - "{{^/?{}(/\\*?)?$}}", - PhpMixed::String(preg_quote(vendor, None)), - ); + let pattern = format!("{{^/?{}(/\\*?)?$}}", preg_quote(vendor, None)); let lines = file(ignore_file, FILE_IGNORE_NEW_LINES).unwrap_or_default(); for line in &lines { @@ -1229,11 +1226,7 @@ impl InitCommand { } if let (Some(name), Some(email)) = (author_name, author_email) { - return Some(format!( - "{} <{}>", - PhpMixed::String(name), - PhpMixed::String(email), - )); + return Some(format!("{} <{}>", name, email)); } None diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index 943eeaf..bce7e9a 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -188,10 +188,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { io.write_error3( &format!( "Using version <info>{}</info> for <info>{}</info>", - PhpMixed::String(version), - PhpMixed::String( - requirement.get("name").cloned().unwrap_or_default(), - ), + version, + requirement.get("name").cloned().unwrap_or_default(), ), true, io_interface::NORMAL, @@ -295,23 +293,20 @@ pub trait PackageDiscoveryTrait: BaseCommand { if let Some(ai) = &found_package.abandoned { let replacement = match ai { crate::repository::AbandonedInfo::Replacement(r) => { - format!("Use {} instead", PhpMixed::String(r.clone())) + format!("Use {} instead", r.clone()) } crate::repository::AbandonedInfo::Abandoned => { "No replacement was suggested".to_string() } }; - abandoned = format!( - "<warning>Abandoned. {}.</warning>", - PhpMixed::String(replacement), - ); + abandoned = format!("<warning>Abandoned. {}.</warning>", replacement); } choices.push(format!( " <info>{:>5}</info> {} {}", - PhpMixed::String(format!("[{}]", position)), - PhpMixed::String(found_package.name.clone()), - PhpMixed::String(abandoned), + format!("[{}]", position), + found_package.name.clone(), + abandoned, )); } @@ -319,8 +314,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { io.write_error3( &format!( "Found <info>{}</info> packages matching <info>{}</info>", - PhpMixed::Int(matches.len() as i64), - PhpMixed::String(package.clone()), + matches.len() as i64, + package.clone(), ), true, io_interface::NORMAL, @@ -432,8 +427,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { io.write_error3( &format!( "Using version <info>{}</info> for <info>{}</info>", - PhpMixed::String(c.clone()), - PhpMixed::String(package.clone()), + c.clone(), + package.clone(), ), true, io_interface::NORMAL, @@ -563,7 +558,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Package {} has requirements incompatible with your PHP version, PHP extensions and Composer version{}", - PhpMixed::String(name.to_string()), + name.to_string(), self.get_platform_exception_details( candidate.clone(), platform_repo, @@ -617,8 +612,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find a version of package {} matching your minimum-stability ({}). Require it with an explicit version constraint allowing its desired stability.", - PhpMixed::String(name.to_string()), - PhpMixed::String(effective_minimum_stability.clone()), + name.to_string(), + effective_minimum_stability.clone(), ), code: 0, } @@ -659,12 +654,12 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find package {} in any version matching your PHP version, PHP extensions and Composer version{}{}", - PhpMixed::String(name.to_string()), + name.to_string(), self.get_platform_exception_details( candidate.clone(), platform_repo, )?, - PhpMixed::String(additional), + additional, ), code: 0, } @@ -688,7 +683,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find package {}. It was however found via repository search, which indicates a consistency issue with the repository.", - PhpMixed::String(name.to_string()), + name.to_string(), ), code: 0, } @@ -725,13 +720,13 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find package {}.\n\nDid you mean {}?\n {}", - PhpMixed::String(name.to_string()), + name.to_string(), if similar.len() > 1 { "one of these" } else { "this" }, - PhpMixed::String(implode("\n ", &similar)), + implode("\n ", &similar), ), code: 0, } @@ -741,8 +736,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find a matching version of package {}. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability ({}).", - PhpMixed::String(name.to_string()), - PhpMixed::String(effective_minimum_stability), + name.to_string(), + effective_minimum_stability, ), code: 0, } diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs index 0cac581..d880ca0 100644 --- a/crates/shirabe/src/command/remove_command.rs +++ b/crates/shirabe/src/command/remove_command.rs @@ -67,112 +67,112 @@ impl Command for RemoveCommand { InputArgument::new("packages", Some(InputArgument::IS_ARRAY), "Packages that should be removed.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("dev", None, Some(InputOption::VALUE_NONE), "Removes a package from the require-dev section.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("dry-run", None, Some(InputOption::VALUE_NONE), "Outputs the operations but will not execute anything (implicitly enables --verbose).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-progress", None, Some(InputOption::VALUE_NONE), "Do not output download progress.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-update", None, Some(InputOption::VALUE_NONE), "Disables the automatic update of the dependencies (implies --no-install).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-install", None, Some(InputOption::VALUE_NONE), "Skip the install step after updating the composer.lock file.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-audit", None, Some(InputOption::VALUE_NONE), "Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", - Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string())),).unwrap().into(), + Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).unwrap().into(), InputOption::new("no-security-blocking", None, Some(InputOption::VALUE_NONE), "Allows installing packages with security advisories or that are abandoned (can also be set via the COMPOSER_NO_SECURITY_BLOCKING=1 env var).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("update-no-dev", None, Some(InputOption::VALUE_NONE), "Run the dependency update with the --no-dev option.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("update-with-dependencies", Some(PhpMixed::String("w".to_string())), Some(InputOption::VALUE_NONE), "Allows inherited dependencies to be updated with explicit dependencies (can also be set via the COMPOSER_WITH_DEPENDENCIES=1 env var). (Deprecated, is now default behavior)", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("update-with-all-dependencies", Some(PhpMixed::String("W".to_string())), Some(InputOption::VALUE_NONE), "Allows all inherited dependencies to be updated, including those that are root requirements (can also be set via the COMPOSER_WITH_ALL_DEPENDENCIES=1 env var).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("with-all-dependencies", None, Some(InputOption::VALUE_NONE), "Alias for --update-with-all-dependencies", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-update-with-dependencies", None, Some(InputOption::VALUE_NONE), "Does not allow inherited dependencies to be updated with explicit dependencies.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("minimal-changes", Some(PhpMixed::String("m".to_string())), Some(InputOption::VALUE_NONE), "During an update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("unused", None, Some(InputOption::VALUE_NONE), "Remove all packages which are locked but not required by any other package.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("ignore-platform-req", None, Some(InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY), "Ignore a specific platform requirement (php & ext- packages).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("ignore-platform-reqs", None, Some(InputOption::VALUE_NONE), "Ignore all platform requirements (php & ext- packages).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("optimize-autoloader", Some(PhpMixed::String("o".to_string())), Some(InputOption::VALUE_NONE), "Optimize autoloader during autoloader dump", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("classmap-authoritative", Some(PhpMixed::String("a".to_string())), Some(InputOption::VALUE_NONE), "Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("apcu-autoloader", None, Some(InputOption::VALUE_NONE), "Use APCu to cache found/not-found classes.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("apcu-autoloader-prefix", None, Some(InputOption::VALUE_REQUIRED), "Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader", - None,).unwrap().into(), + None).unwrap().into(), ]); self.set_help( "The <info>remove</info> command removes a package from the current\n\ diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index b1dfd4a..4bed4df 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -463,7 +463,7 @@ impl Command for RequireCommand { if strtolower(package) == composer.get_package().get_name() { let msg = format!( "<error>Root package '{}' cannot require itself in its composer.json</error>", - PhpMixed::String(package.clone()), + package.clone(), ); self.get_io().write_error3(&msg, true, io_interface::NORMAL); @@ -481,17 +481,15 @@ impl Command for RequireCommand { for package in &inconsistent_require_keys { let warn_msg = format!( "{} is currently present in the {} key and you ran the command {} the --dev flag, which will move it to the {} key.", - PhpMixed::String(package.clone()), - PhpMixed::String(remove_key.to_string()), - PhpMixed::String( - if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { - "with" - } else { - "without" - } - .to_string(), - ), - PhpMixed::String(require_key.to_string()), + package.clone(), + remove_key.to_string(), + if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { + "with" + } else { + "without" + } + .to_string(), + require_key.to_string(), ); self.get_io().warning(&warn_msg, &[]); } @@ -499,26 +497,22 @@ impl Command for RequireCommand { if self.get_io().is_interactive() { let q1 = format!( "<info>Do you want to move {}?</info> [<comment>no</comment>]? ", - PhpMixed::String( - if (inconsistent_require_keys.len() as i64) > 1 { - "these requirements" - } else { - "this requirement" - } - .to_string(), - ), + if (inconsistent_require_keys.len() as i64) > 1 { + "these requirements" + } else { + "this requirement" + } + .to_string(), ); if !self.get_io().ask_confirmation(q1, false) { let q2 = format!( "<info>Do you want to re-run the command {} --dev?</info> [<comment>yes</comment>]? ", - PhpMixed::String( - if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { - "without" - } else { - "with" - } - .to_string(), - ), + if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { + "without" + } else { + "with" + } + .to_string(), ); if !self.get_io().ask_confirmation(q2, true) { return Ok(0); @@ -1122,8 +1116,8 @@ impl RequireCommand { self.get_io().write_error3( &format!( "Using version <info>{}</info> for <info>{}</info>", - PhpMixed::String(requirements.get(package_name).cloned().unwrap_or_default(),), - PhpMixed::String(package_name.clone()), + requirements.get(package_name).cloned().unwrap_or_default(), + package_name.clone(), ), true, io_interface::NORMAL, diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index 9073658..1903dec 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -707,9 +707,7 @@ impl UpdateCommand { if io.ask_confirmation( format!( "Would you like to continue and update the above package{} [<comment>yes</comment>]? ", - PhpMixed::String( - if 1 == packages.len() { "" } else { "s" }.to_string(), - ), + if 1 == packages.len() { "" } else { "s" }.to_string(), ), true, ) { diff --git a/crates/shirabe/src/config/json_config_source.rs b/crates/shirabe/src/config/json_config_source.rs index 85bd12e..3e0d285 100644 --- a/crates/shirabe/src/config/json_config_source.rs +++ b/crates/shirabe/src/config/json_config_source.rs @@ -37,7 +37,7 @@ impl JsonConfigSource { return Err(RuntimeException { message: format!( "The file \"{}\" is not writable.", - PhpMixed::String(self.file.borrow().get_path().to_string()), + self.file.borrow().get_path().to_string(), ), code: 0, } @@ -48,7 +48,7 @@ impl JsonConfigSource { return Err(RuntimeException { message: format!( "The file \"{}\" is not readable.", - PhpMixed::String(self.file.borrow().get_path().to_string()), + self.file.borrow().get_path().to_string(), ), code: 0, } @@ -401,7 +401,7 @@ impl ConfigSourceInterface for JsonConfigSource { return Err(RuntimeException { message: format!( "The referenced repository \"{}\" does not exist.", - PhpMixed::String(reference_name.to_string()), + reference_name.to_string(), ), code: 0, } diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index 7f22a65..251fc67 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -549,7 +549,7 @@ impl Application { if !composer::BRANCH_ALIAS_VERSION.is_empty() && composer::BRANCH_ALIAS_VERSION != "@package_branch_alias_version@" { - branch_alias_string = format!(" ({})", composer::BRANCH_ALIAS_VERSION,); + branch_alias_string = format!(" ({})", composer::BRANCH_ALIAS_VERSION); } format!( @@ -796,10 +796,7 @@ impl Application { ) -> anyhow::Result<std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>>> { if !self.has(name) { return Err(CommandNotFoundException::new( - format!( - "The command \"{}\" does not exist.", - PhpMixed::from(name.to_string()), - ), + format!("The command \"{}\" does not exist.", name.to_string()), Vec::new(), 0, ) @@ -811,7 +808,7 @@ impl Application { return Err(CommandNotFoundException::new( format!( "The \"{}\" command cannot be found because it is registered under multiple names. Make sure you don't set a different name via constructor or \"setName()\".", - PhpMixed::from(name.to_string()), + name.to_string(), ), Vec::new(), 0, @@ -914,7 +911,7 @@ impl Application { if namespaces.is_empty() { let mut message = format!( "There are no commands defined in the \"{}\" namespace.", - PhpMixed::from(namespace.to_string()), + namespace.to_string(), ); let alternatives = self.find_alternatives(namespace, &all_namespaces); @@ -941,8 +938,8 @@ impl Application { return Err(NamespaceNotFoundException(CommandNotFoundException::new( format!( "The namespace \"{}\" is ambiguous.\nDid you mean one of these?\n{}.", - PhpMixed::from(namespace.to_string()), - PhpMixed::from(self.get_abbreviation_suggestions(&namespaces)), + namespace.to_string(), + self.get_abbreviation_suggestions(&namespaces), ), namespaces.clone(), 0, @@ -1143,8 +1140,8 @@ impl Application { return Err(CommandNotFoundException::new( format!( "SymfonyCommand \"{}\" is ambiguous.\nDid you mean one of these?\n{}.", - PhpMixed::from(name.to_string()), - PhpMixed::from(suggestions), + name.to_string(), + suggestions, ), commands.clone(), 0, @@ -1159,10 +1156,7 @@ impl Application { if command.borrow().is_hidden() { return Err(CommandNotFoundException::new( - format!( - "The command \"{}\" does not exist.", - PhpMixed::from(name.to_string()), - ), + format!("The command \"{}\" does not exist.", name.to_string()), Vec::new(), 0, ) @@ -1885,7 +1879,7 @@ impl ApplicationHandle { return Err(ConsoleLogicException(shirabe_php_shim::LogicException { message: format!( "The command defined in \"{}\" cannot have an empty name.", - PhpMixed::from(shirabe_php_shim::get_debug_type_obj(&command)), + shirabe_php_shim::get_debug_type_obj(&command), ), code: 0, }) @@ -2804,7 +2798,7 @@ impl ApplicationHandle { let formatted_block = FormatterHelper::default().format_block( FormatBlockMessages::String(format!( "Command \"{}\" is not defined.", - PhpMixed::from(name.clone()), + name.clone(), )), "error", true, @@ -2813,10 +2807,7 @@ impl ApplicationHandle { .borrow() .writeln(&[formatted_block], output_interface::OUTPUT_NORMAL); if !style.confirm( - &format!( - "Do you want to run \"{}\" instead? ", - PhpMixed::from(alternative.clone()), - ), + &format!("Do you want to run \"{}\" instead? ", alternative.clone()), false, ) { return Ok(1); diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs index 23b025f..15275a9 100644 --- a/crates/shirabe/src/downloader/download_manager.rs +++ b/crates/shirabe/src/downloader/download_manager.rs @@ -112,8 +112,8 @@ impl DownloadManager { return Err(InvalidArgumentException { message: format!( "Unknown downloader type: {}. Available types: {}.", - PhpMixed::String(r#type), - PhpMixed::String(implode(", ", &array_keys(&self.downloaders))), + r#type, + implode(", ", &array_keys(&self.downloaders)), ), code: 0, } @@ -159,10 +159,10 @@ impl DownloadManager { return Err(LogicException { message: format!( "Downloader \"{}\" is a {} type downloader and can not be used to download {} for package {}", - PhpMixed::String(shirabe_php_shim::get_class_obj(&*downloader.borrow())), - PhpMixed::String(downloader_installation_source), - PhpMixed::String(installation_source.clone().unwrap_or_default()), - PhpMixed::String(package.to_string()), + shirabe_php_shim::get_class_obj(&*downloader.borrow()), + downloader_installation_source, + installation_source.clone().unwrap_or_default(), + package.to_string(), ), code: 0, } diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs index 0a6e242..fa7fd16 100644 --- a/crates/shirabe/src/downloader/git_downloader.rs +++ b/crates/shirabe/src/downloader/git_downloader.rs @@ -811,10 +811,7 @@ impl VcsDownloader for GitDownloader { io_interface::NORMAL, ); self.inner.io.write_error3( - &format!( - " Cloning to cache at {}", - PhpMixed::String(cache_path.clone()), - ), + &format!(" Cloning to cache at {}", cache_path.clone()), true, io_interface::DEBUG, ); diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs index 482a343..78b3ae7 100644 --- a/crates/shirabe/src/downloader/vcs_downloader.rs +++ b/crates/shirabe/src/downloader/vcs_downloader.rs @@ -161,7 +161,7 @@ pub trait VcsDownloader: } if self.io().is_debug() { self.io().write_error3( - &format!("Failed: [{}] {}", get_class_err(&e), e,), + &format!("Failed: [{}] {}", get_class_err(&e), e), true, io_interface::NORMAL, ); @@ -265,7 +265,7 @@ pub trait VcsDownloader: } if self.io().is_debug() { self.io().write_error3( - &format!("Failed: [{}] {}", get_class_err(&e), e,), + &format!("Failed: [{}] {}", get_class_err(&e), e), true, io_interface::NORMAL, ); @@ -334,7 +334,7 @@ pub trait VcsDownloader: } if self.io().is_debug() { self.io().write_error3( - &format!("Failed: [{}] {}", get_class_err(&e), e,), + &format!("Failed: [{}] {}", get_class_err(&e), e), true, io_interface::NORMAL, ); diff --git a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs index d3b5fad..3ef7661 100644 --- a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs +++ b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs @@ -343,8 +343,8 @@ impl EventDispatcher { self.io.write_error3( &format!( "> {}: {}", - PhpMixed::String(formatted_event_name_with_args.clone()), - PhpMixed::String(format!("{}->{}", prefix, method_name)), + formatted_event_name_with_args.clone(), + format!("{}->{}", prefix, method_name), ), true, crate::io::VERBOSE, @@ -358,8 +358,8 @@ impl EventDispatcher { self.io.write_error3( &format!( "> {}: {}", - PhpMixed::String(formatted_event_name_with_args.clone()), - PhpMixed::String(callable_str.clone()), + formatted_event_name_with_args.clone(), + callable_str.clone(), ), true, crate::io::VERBOSE, @@ -416,8 +416,8 @@ impl EventDispatcher { if exit_code != 0 { self.io.write_error3(&format!( "<error>Script {} handling the {} event returned with error code {}</error>", - PhpMixed::String(callable_str.clone()), - PhpMixed::String(event.get_name().to_string()), + callable_str.clone(), + event.get_name().to_string(), exit_code ), true, crate::io::QUIET); @@ -442,7 +442,7 @@ impl EventDispatcher { { self.io.write_error3(&format!( "<warning>You made a reference to a non-existent script {}</warning>", - PhpMixed::String(callable_str.clone()), + callable_str.clone(), ), true, crate::io::QUIET); } @@ -469,8 +469,8 @@ impl EventDispatcher { self.io.write_error3( &format!( "<error>Script {} was called via {}</error>", - PhpMixed::String(callable_str.clone()), - PhpMixed::String(event.get_name().to_string()), + callable_str.clone(), + event.get_name().to_string(), ), true, crate::io::QUIET, @@ -513,8 +513,8 @@ impl EventDispatcher { self.io.write_error3( &format!( "<error>Script {} handling the {} event terminated with an exception</error>", - PhpMixed::String(callable_str.clone()), - PhpMixed::String(event.get_name().to_string()), + callable_str.clone(), + event.get_name().to_string(), ), true, crate::io::QUIET, @@ -613,17 +613,13 @@ impl EventDispatcher { if self.io.is_verbose() { self.io.write_error3( - &format!( - "> {}: {}", - PhpMixed::String(event.get_name().to_string()), - PhpMixed::String(exec.clone()), - ), + &format!("> {}: {}", event.get_name().to_string(), exec.clone()), true, crate::io::NORMAL, ); } else if self.event_needs_to_output(event) { self.io.write_error3( - &format!("> {}", PhpMixed::String(exec.clone())), + &format!("> {}", exec.clone()), true, crate::io::NORMAL, ); @@ -741,8 +737,8 @@ impl EventDispatcher { if exit_code != 0 { self.io.write_error3(&format!( "<error>Script {} handling the {} event returned with error code {}</error>", - PhpMixed::String(callable_str.clone()), - PhpMixed::String(event.get_name().to_string()), + callable_str.clone(), + event.get_name().to_string(), exit_code ), true, crate::io::QUIET); @@ -843,20 +839,16 @@ impl EventDispatcher { self.io.write_error3( &format!( "> {}: {}::{}", - PhpMixed::String(event.get_name().to_string()), - PhpMixed::String(class_name.to_string()), - PhpMixed::String(method_name.to_string()), + event.get_name().to_string(), + class_name.to_string(), + method_name.to_string(), ), true, crate::io::NORMAL, ); } else if self.event_needs_to_output(event) { self.io.write_error3( - &format!( - "> {}::{}", - PhpMixed::String(class_name.to_string()), - PhpMixed::String(method_name.to_string()), - ), + &format!("> {}::{}", class_name.to_string(), method_name.to_string()), true, crate::io::NORMAL, ); diff --git a/crates/shirabe/src/installed_versions.rs b/crates/shirabe/src/installed_versions.rs index 3e43f90..fb93172 100644 --- a/crates/shirabe/src/installed_versions.rs +++ b/crates/shirabe/src/installed_versions.rs @@ -452,7 +452,7 @@ impl InstalledVersions { installed.push(cached); } else if is_file(&format!("{}/composer/installed.php", vendor_dir)) { let required = - require_php_file(&format!("{}/composer/installed.php", vendor_dir,)); + require_php_file(&format!("{}/composer/installed.php", vendor_dir)); let required_map: IndexMap<String, PhpMixed> = required.as_array().cloned().unwrap_or_default(); INSTALLED_BY_VENDOR diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs index c83308c..1876db4 100644 --- a/crates/shirabe/src/io/console_io.rs +++ b/crates/shirabe/src/io/console_io.rs @@ -106,14 +106,7 @@ impl ConsoleIO { }; let mapped: Vec<String> = arr .into_iter() - .map(|message| { - format!( - "[{:.1}MiB/{:.2}s] {}", - memory_usage, - time_spent, - PhpMixed::String(message), - ) - }) + .map(|message| format!("[{:.1}MiB/{:.2}s] {}", memory_usage, time_spent, message)) .collect(); PhpMixed::List(mapped.into_iter().map(PhpMixed::String).collect()) } else { diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index 0aada36..e6cd990 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -385,7 +385,7 @@ impl JsonFile { let mut m = indexmap::IndexMap::new(); m.insert( "$ref".to_string(), - PhpMixed::String(format!("{}#/properties/config", schema_file,)), + PhpMixed::String(format!("{}#/properties/config", schema_file)), ); m.insert( "$schema".to_string(), diff --git a/crates/shirabe/src/package/loader/array_loader.rs b/crates/shirabe/src/package/loader/array_loader.rs index 0411645..844b3ef 100644 --- a/crates/shirabe/src/package/loader/array_loader.rs +++ b/crates/shirabe/src/package/loader/array_loader.rs @@ -385,14 +385,13 @@ impl ArrayLoader { return Err(UnexpectedValueException { message: format!( "Package {}'s source key should be specified as {{\"type\": ..., \"url\": ..., \"reference\": ...}},\n{} given.", - PhpMixed::String( + config .get("name") .and_then(|v| v.as_string()) .unwrap_or("") .to_string(), - ), - PhpMixed::String(json_encode(&source).unwrap_or_default()), + json_encode(&source).unwrap_or_default(), ), code: 0, } @@ -428,14 +427,13 @@ impl ArrayLoader { return Err(UnexpectedValueException { message: format!( "Package {}'s dist key should be specified as {{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...}},\n{} given.", - PhpMixed::String( + config .get("name") .and_then(|v| v.as_string()) .unwrap_or("") .to_string(), - ), - PhpMixed::String(json_encode(&dist).unwrap_or_default()), + json_encode(&dist).unwrap_or_default(), ), code: 0, } diff --git a/crates/shirabe/src/package/loader/root_package_loader.rs b/crates/shirabe/src/package/loader/root_package_loader.rs index 50374d2..16b905e 100644 --- a/crates/shirabe/src/package/loader/root_package_loader.rs +++ b/crates/shirabe/src/package/loader/root_package_loader.rs @@ -266,7 +266,7 @@ impl RootPackageLoader { for (req_name, req_version) in requires { let mut m: IndexMap<CaptureKey, String> = IndexMap::new(); if Preg::is_match3( - r"(?:^|\| *|, *)([^,\s#|]+)(?:#[^ ]+)? +as +([^,\s|]+)(?:$| *\|| *,)", + r"(?:^|\| *|, *)([^,\s#|]+)(?:#[^ ]+)? +as +([^,\s|]+)(?:$| *\|| *)", req_version, Some(&mut m), ) { diff --git a/crates/shirabe/src/package/loader/validating_array_loader.rs b/crates/shirabe/src/package/loader/validating_array_loader.rs index 8081664..342e1cb 100644 --- a/crates/shirabe/src/package/loader/validating_array_loader.rs +++ b/crates/shirabe/src/package/loader/validating_array_loader.rs @@ -196,7 +196,7 @@ impl ValidatingArrayLoader { if !is_string(&license) { self.warnings.push(format!( "License {} should be a string.", - PhpMixed::String(json_encode(&license).unwrap_or_default()), + json_encode(&license).unwrap_or_default(), )); licenses.shift_remove(index); } @@ -219,18 +219,15 @@ impl ValidatingArrayLoader { { self.warnings.push(format!( "License {} must not contain extra spaces, make sure to trim it.", - PhpMixed::String( json_encode(&PhpMixed::String(license_str.clone())) .unwrap_or_default(), - ), )); } else { self.warnings.push(format!( "License {} is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.{}If the software is closed-source, you may use \"proprietary\" as license.", - PhpMixed::String( + json_encode(&PhpMixed::String(license_str.clone())) .unwrap_or_default(), - ), PHP_EOL )); } @@ -248,7 +245,7 @@ impl ValidatingArrayLoader { } else { self.warnings.push(format!( "License must be a string or array of strings, got {}.", - PhpMixed::String(json_encode(&license_val).unwrap_or_default(),), + json_encode(&license_val).unwrap_or_default(), )); self.config.shift_remove("license"); } diff --git a/crates/shirabe/src/package/locker.rs b/crates/shirabe/src/package/locker.rs index 155d5d4..a034497 100644 --- a/crates/shirabe/src/package/locker.rs +++ b/crates/shirabe/src/package/locker.rs @@ -730,7 +730,7 @@ impl Locker { return Err(LogicException { message: format!( "Package \"{}\" has no version or name and can not be locked", - PhpMixed::String(package.to_string()), + package.to_string(), ), code: 0, } @@ -955,14 +955,12 @@ impl Locker { description = format!( "{} as {} by {}", verb, - PhpMixed::String( - provider_link.get_pretty_constraint().to_string(), - ), - PhpMixed::String(format!( + provider_link.get_pretty_constraint().to_string(), + format!( "{} {}", provider.get_pretty_name(), provider.get_pretty_version() - )), + ), ); break 'outer; } diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index 2f74eaf..670bfb4 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -327,7 +327,7 @@ impl FilesystemRepository { self.filesystem.borrow_mut().file_put_contents_if_modified( &format!("{}/installed.php", repo_dir), - &format!("<?php return {};\n", self.dump_to_php_code(&versions, 0),), + &format!("<?php return {};\n", self.dump_to_php_code(&versions, 0)), ); self.filesystem.borrow_mut().file_put_contents_if_modified( &format!("{}/InstalledVersions.php", repo_dir), @@ -422,7 +422,7 @@ impl FilesystemRepository { } else if key == "install_path" && is_string(value) { let s = value.as_string().unwrap_or("").to_string(); if self.filesystem.borrow_mut().is_absolute_path(&s) { - lines.push_str(&format!("{},\n", var_export(&PhpMixed::String(s), true),)); + lines.push_str(&format!("{},\n", var_export(&PhpMixed::String(s), true))); } else { lines.push_str(&format!( "__DIR__ . {},\n", diff --git a/crates/shirabe/src/repository/platform_repository.rs b/crates/shirabe/src/repository/platform_repository.rs index e006d19..26005e2 100644 --- a/crates/shirabe/src/repository/platform_repository.rs +++ b/crates/shirabe/src/repository/platform_repository.rs @@ -1278,9 +1278,9 @@ impl PlatformRepository { .unwrap_or(0); let version_built = format!( "{}.{}.{}", - PhpMixed::Int((lib_rd_kafka_version_int & 0x7F000000) >> 24), - PhpMixed::Int((lib_rd_kafka_version_int & 0x00FF0000) >> 16), - PhpMixed::Int((lib_rd_kafka_version_int & 0x0000FF00) >> 8), + (lib_rd_kafka_version_int & 0x7F000000) >> 24, + (lib_rd_kafka_version_int & 0x00FF0000) >> 16, + (lib_rd_kafka_version_int & 0x0000FF00) >> 8, ); self.add_library( &mut libraries, diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index fb450d8..b5469ec 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -95,7 +95,7 @@ impl GitBitbucketDriver { return Err(InvalidArgumentException { message: format!( "The Bitbucket repository URL {} is invalid. It must be the HTTPS URL of a Bitbucket repository.", - PhpMixed::String(self.inner.url.clone()), + self.inner.url.clone(), ), code: 0, } @@ -154,9 +154,9 @@ impl GitBitbucketDriver { fn get_repo_data(&mut self) -> Result<bool> { let resource = format!( "https://api.bitbucket.org/2.0/repositories/{}/{}?{}", - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), - PhpMixed::String(http_build_query_mixed( + self.owner.clone(), + self.repository.clone(), + http_build_query_mixed( &{ let mut m: IndexMap<String, PhpMixed> = IndexMap::new(); m.insert( @@ -167,7 +167,7 @@ impl GitBitbucketDriver { }, "", "&", - )), + ), ); let repo_data = self @@ -349,9 +349,9 @@ impl GitBitbucketDriver { "source".to_string(), PhpMixed::String(format!( "https://{}/{}/{}/src", - PhpMixed::String(self.inner.origin_url.clone()), - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), + self.inner.origin_url.clone(), + self.owner.clone(), + self.repository.clone(), )), ); } @@ -360,11 +360,11 @@ impl GitBitbucketDriver { "source".to_string(), PhpMixed::String(format!( "https://{}/{}/{}/src/{}/?at={}", - PhpMixed::String(self.inner.origin_url.clone()), - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), - PhpMixed::String(hash.unwrap()), - PhpMixed::String(label.clone()), + self.inner.origin_url.clone(), + self.owner.clone(), + self.repository.clone(), + hash.unwrap(), + label.clone(), )), ); } @@ -385,9 +385,9 @@ impl GitBitbucketDriver { "issues".to_string(), PhpMixed::String(format!( "https://{}/{}/{}/issues", - PhpMixed::String(self.inner.origin_url.clone()), - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), + self.inner.origin_url.clone(), + self.owner.clone(), + self.repository.clone(), )), ); } @@ -429,10 +429,10 @@ impl GitBitbucketDriver { let resource = format!( "https://api.bitbucket.org/2.0/repositories/{}/{}/src/{}/{}", - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), - PhpMixed::String(identifier), - PhpMixed::String(file.to_string()), + self.owner.clone(), + self.repository.clone(), + identifier, + file.to_string(), ); Ok(self @@ -457,9 +457,9 @@ impl GitBitbucketDriver { let resource = format!( "https://api.bitbucket.org/2.0/repositories/{}/{}/commit/{}?fields=date", - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), - PhpMixed::String(identifier), + self.owner.clone(), + self.repository.clone(), + identifier, ); let commit = self .fetch_with_oauth_credentials(&resource, false)? @@ -498,9 +498,9 @@ impl GitBitbucketDriver { let url = format!( "https://bitbucket.org/{}/{}/get/{}.zip", - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), - PhpMixed::String(identifier.to_string()), + self.owner.clone(), + self.repository.clone(), + identifier.to_string(), ); let mut m: IndexMap<String, String> = IndexMap::new(); @@ -521,8 +521,8 @@ impl GitBitbucketDriver { let mut tags: IndexMap<String, String> = IndexMap::new(); let mut resource = format!( "{}?{}", - PhpMixed::String(self.tags_url.clone()), - PhpMixed::String(http_build_query_mixed( + self.tags_url.clone(), + http_build_query_mixed( &{ let mut m: IndexMap<String, PhpMixed> = IndexMap::new(); m.insert("pagelen".to_string(), PhpMixed::Int(100)); @@ -538,7 +538,7 @@ impl GitBitbucketDriver { }, "", "&", - )), + ), ); let mut has_next = true; while has_next { @@ -600,8 +600,8 @@ impl GitBitbucketDriver { let mut branches: IndexMap<String, String> = IndexMap::new(); let mut resource = format!( "{}?{}", - PhpMixed::String(self.branches_url.clone()), - PhpMixed::String(http_build_query_mixed( + self.branches_url.clone(), + http_build_query_mixed( &{ let mut m: IndexMap<String, PhpMixed> = IndexMap::new(); m.insert("pagelen".to_string(), PhpMixed::Int(100)); @@ -619,7 +619,7 @@ impl GitBitbucketDriver { }, "", "&", - )), + ), ); let mut has_next = true; while has_next { diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index e9956a9..bea7294 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -82,7 +82,7 @@ impl GitHubDriver { return Err(InvalidArgumentException { message: format!( "The GitHub repository URL {} is invalid.", - PhpMixed::String(self.inner.url.clone()), + self.inner.url.clone(), ), code: 0, } @@ -364,10 +364,10 @@ impl GitHubDriver { "source".to_string(), PhpMixed::String(format!( "https://{}/{}/{}/tree/{}", - PhpMixed::String(self.inner.origin_url.clone()), - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), - PhpMixed::String(label_str), + self.inner.origin_url.clone(), + self.owner.clone(), + self.repository.clone(), + label_str, )), ); } @@ -388,9 +388,9 @@ impl GitHubDriver { "issues".to_string(), PhpMixed::String(format!( "https://{}/{}/{}/issues", - PhpMixed::String(self.inner.origin_url.clone()), - PhpMixed::String(self.owner.clone()), - PhpMixed::String(self.repository.clone()), + self.inner.origin_url.clone(), + self.owner.clone(), + self.repository.clone(), )), ); } diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index e0fb72e..f1f361e 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -88,7 +88,7 @@ impl GitLabDriver { return Err(InvalidArgumentException { message: format!( "The GitLab repository URL {} is invalid. It must be the HTTP URL of a GitLab project.", - PhpMixed::String(self.inner.url.clone()), + self.inner.url.clone(), ), code: 0, } @@ -357,11 +357,7 @@ impl GitLabDriver { }) { support.insert( "source".to_string(), - PhpMixed::String(format!( - "{}/-/tree/{}", - PhpMixed::String(web_url), - PhpMixed::String(label_str), - )), + PhpMixed::String(format!("{}/-/tree/{}", web_url, label_str)), ); } } @@ -388,7 +384,7 @@ impl GitLabDriver { }) { support.insert( "issues".to_string(), - PhpMixed::String(format!("{}/-/issues", PhpMixed::String(web_url),)), + PhpMixed::String(format!("{}/-/issues", PhpMixed::String(web_url))), ); } } diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index d8b77ac..0b1620d 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -418,7 +418,7 @@ impl AuthHelper { } self.io.write_error3( - &format!(" Authentication required (<info>{}</info>):", origin,), + &format!(" Authentication required (<info>{}</info>):", origin), true, io_interface::NORMAL, ); diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 94e703d..4b8348f 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -1548,15 +1548,13 @@ impl CurlDownloader { self.io.write_error3( &format!( "Following redirect ({}) {}", - PhpMixed::Int( - job.get("attributes") - .and_then(|v| v.as_array()) - .and_then(|a| a.get("redirects")) - .and_then(|b| b.as_int()) - .unwrap_or(0) - + 1, - ), - PhpMixed::String(Url::sanitize(target_url.clone())), + job.get("attributes") + .and_then(|v| v.as_array()) + .and_then(|a| a.get("redirects")) + .and_then(|b| b.as_int()) + .unwrap_or(0) + + 1, + Url::sanitize(target_url.clone()), ), true, crate::io::DEBUG, diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs index e36a174..2a15cf0 100644 --- a/crates/shirabe/src/util/remote_filesystem.rs +++ b/crates/shirabe/src/util/remote_filesystem.rs @@ -951,8 +951,8 @@ impl RemoteFilesystem { self.io.write_error3( &format!( "Following redirect ({}) {}", - PhpMixed::Int(self.redirects), - PhpMixed::String(Url::sanitize(target_url.clone())), + self.redirects, + Url::sanitize(target_url.clone()), ), true, crate::io::DEBUG, |
