aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/json
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/src/json
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/src/json')
-rw-r--r--crates/shirabe/src/json/json_file.rs6
-rw-r--r--crates/shirabe/src/json/json_manipulator.rs6
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs
index b08a7a97..86dc0a2b 100644
--- a/crates/shirabe/src/json/json_file.rs
+++ b/crates/shirabe/src/json/json_file.rs
@@ -15,7 +15,7 @@ use shirabe_php_shim::{
InvalidArgumentException, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE,
PhpMixed, RuntimeException, UnexpectedValueException, dirname, file_exists, file_get_contents,
file_put_contents, is_dir, is_file, json_decode, json_encode_ex, mkdir, php_regex, realpath,
- str_contains, str_ends_with, str_repeat, strlen, strpos, usleep,
+ str_repeat, strlen, strpos, usleep,
};
use shirabe_seld_json_lint::{ParsingException, ParsingExceptionDetails};
@@ -484,8 +484,8 @@ impl JsonFile {
if matches!(data, PhpMixed::Null) && json != "null" {
// attempt resolving simple conflicts in lock files so that one can run `composer update --lock` and get a valid lock file
if let Some(file) = file
- && str_ends_with(file, ".lock")
- && str_contains(json, "\"content-hash\"")
+ && file.ends_with(".lock")
+ && json.contains("\"content-hash\"")
{
let mut count: usize = 0;
let replaced = Preg::replace5(
diff --git a/crates/shirabe/src/json/json_manipulator.rs b/crates/shirabe/src/json/json_manipulator.rs
index 5a77e771..bbd032e7 100644
--- a/crates/shirabe/src/json/json_manipulator.rs
+++ b/crates/shirabe/src/json/json_manipulator.rs
@@ -8,8 +8,8 @@ use shirabe_pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
InvalidArgumentException, LogicException, PhpMixed, addcslashes, array_key_exists, array_keys,
array_reverse, empty, explode, implode, in_array_loose, is_array, is_int, is_numeric,
- json_decode, php_regex, php_truthy, preg_quote, rtrim, str_contains, str_repeat, str_replace,
- strlen, strnatcmp, strpos, substr, trim, uksort,
+ json_decode, php_regex, php_truthy, preg_quote, rtrim, str_repeat, str_replace, strlen,
+ strnatcmp, strpos, substr, trim, uksort,
};
#[derive(Debug)]
@@ -1061,7 +1061,7 @@ impl JsonManipulator {
let mut item_depth: i64 = 1;
// keep oneline lists as one line
- if !str_contains(&whitespace, &self.newline) {
+ if !whitespace.contains(&self.newline) {
leading_item_whitespace = leading_whitespace.clone();
trailing_item_whitespace = leading_whitespace.clone();
item_depth = 0;