aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-symfony-console/src/input
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-11 23:28:40 +0900
committernsfisis <nsfisis@gmail.com>2026-08-11 23:28:40 +0900
commit38621c67917fd015f884ea04517791cdc5058c6d (patch)
tree03f466e2db22a3bc45e20e4f9694eb371a59b0e1 /crates/shirabe-symfony-console/src/input
parent73ab00d3108933c952844b3820f44230c8203807 (diff)
downloadphp-shirabe-38621c67917fd015f884ea04517791cdc5058c6d.tar.gz
php-shirabe-38621c67917fd015f884ea04517791cdc5058c6d.tar.zst
php-shirabe-38621c67917fd015f884ea04517791cdc5058c6d.zip
chore(php-shim): drop the substring predicate ports
str_contains(), str_starts_with() and str_ends_with() were thin wrappers over the str methods of the same semantics. Call sites now use contains()/starts_with()/ends_with() directly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-symfony-console/src/input')
-rw-r--r--crates/shirabe-symfony-console/src/input/argv_input.rs14
-rw-r--r--crates/shirabe-symfony-console/src/input/array_input.rs4
2 files changed, 8 insertions, 10 deletions
diff --git a/crates/shirabe-symfony-console/src/input/argv_input.rs b/crates/shirabe-symfony-console/src/input/argv_input.rs
index cbd0f6d2..200c7384 100644
--- a/crates/shirabe-symfony-console/src/input/argv_input.rs
+++ b/crates/shirabe-symfony-console/src/input/argv_input.rs
@@ -116,7 +116,7 @@ impl ArgvInput {
self.parse_argument(token)?;
} else if parse_options && token == "--" {
return Ok(false);
- } else if parse_options && shirabe_php_shim::str_starts_with(token, "--") {
+ } else if parse_options && token.starts_with("--") {
self.parse_long_option(token)?;
} else if parse_options && token.as_bytes().first() == Some(&b'-') && token != "-" {
self.parse_short_option(token)?;
@@ -405,7 +405,7 @@ impl ArgvInput {
let mut is_option = false;
for (i, token) in self.tokens.iter().enumerate() {
if !token.is_empty() && token.as_bytes()[0] == b'-' {
- if shirabe_php_shim::str_contains(token, "=") || self.tokens.get(i + 1).is_none() {
+ if token.contains('=') || self.tokens.get(i + 1).is_none() {
continue;
}
@@ -458,14 +458,12 @@ impl ArgvInput {
// Options with values:
// For long options, test for '--option=' at beginning
// For short options, test for '-o' at beginning
- let leading = if shirabe_php_shim::str_starts_with(value, "--") {
+ let leading = if value.starts_with("--") {
format!("{}=", value)
} else {
value.clone()
};
- if token == value
- || (!leading.is_empty() && shirabe_php_shim::str_starts_with(token, &leading))
- {
+ if token == value || (!leading.is_empty() && token.starts_with(&leading)) {
return true;
}
}
@@ -499,12 +497,12 @@ impl ArgvInput {
// Options with values:
// For long options, test for '--option=' at beginning
// For short options, test for '-o' at beginning
- let leading = if shirabe_php_shim::str_starts_with(value, "--") {
+ let leading = if value.starts_with("--") {
format!("{}=", value)
} else {
value.clone()
};
- if !leading.is_empty() && shirabe_php_shim::str_starts_with(&token, &leading) {
+ if !leading.is_empty() && token.starts_with(&leading) {
return PhpMixed::String(shirabe_php_shim::substr(
&token,
shirabe_php_shim::strlen(&leading),
diff --git a/crates/shirabe-symfony-console/src/input/array_input.rs b/crates/shirabe-symfony-console/src/input/array_input.rs
index d93501c7..e19381a9 100644
--- a/crates/shirabe-symfony-console/src/input/array_input.rs
+++ b/crates/shirabe-symfony-console/src/input/array_input.rs
@@ -139,9 +139,9 @@ impl ArrayInput {
if key == "--" {
return Ok(());
}
- if shirabe_php_shim::str_starts_with(&key, "--") {
+ if key.starts_with("--") {
self.add_long_option(&shirabe_php_shim::substr(&key, 2, None), value)?;
- } else if shirabe_php_shim::str_starts_with(&key, "-") {
+ } else if key.starts_with("-") {
self.add_short_option(&shirabe_php_shim::substr(&key, 1, None), value)?;
} else {
self.add_argument(&PhpMixed::String(key), value)?;