diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-22 01:43:34 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-22 01:44:05 +0900 |
| commit | 6739da8a8e271a82d1bf8ca79bba58640ae6e743 (patch) | |
| tree | ce397b02662cf3c101cb36545b0a6c94ddc21826 /crates/shirabe/src/json/json_manipulator.rs | |
| parent | 0b06f54103490e3ce5658e82bbc0119633e26cd8 (diff) | |
| download | php-shirabe-6739da8a8e271a82d1bf8ca79bba58640ae6e743.tar.gz php-shirabe-6739da8a8e271a82d1bf8ca79bba58640ae6e743.tar.zst php-shirabe-6739da8a8e271a82d1bf8ca79bba58640ae6e743.zip | |
refactor(php-shim): remove unnecessary methods
Diffstat (limited to 'crates/shirabe/src/json/json_manipulator.rs')
| -rw-r--r-- | crates/shirabe/src/json/json_manipulator.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/shirabe/src/json/json_manipulator.rs b/crates/shirabe/src/json/json_manipulator.rs index c9ca7f7..e5510d3 100644 --- a/crates/shirabe/src/json/json_manipulator.rs +++ b/crates/shirabe/src/json/json_manipulator.rs @@ -269,7 +269,7 @@ impl JsonManipulator { .and_then(|o| o.to_array().get("repositories").cloned()); let is_std_class = repositories_value .as_ref() - .map(|v| v.as_any().is::<StdClass>()) + .map(|v| (&**v as &dyn std::any::Any).is::<StdClass>()) .unwrap_or(false); if is_std_class { @@ -290,7 +290,7 @@ impl JsonManipulator { // re-add in order for (repository_name, repository) in &repos_arr { - let is_obj = repository.as_any().is::<StdClass>(); + let is_obj = (&**repository as &dyn std::any::Any).is::<StdClass>(); if !is_obj { let mut m: IndexMap<String, Box<PhpMixed>> = IndexMap::new(); m.insert(repository_name.clone(), repository.clone()); @@ -515,7 +515,7 @@ impl JsonManipulator { .and_then(|o| o.to_array().get("repositories").cloned()); let is_assoc = repositories_value .as_ref() - .map(|v| v.as_any().is::<StdClass>()) + .map(|v| (&**v as &dyn std::any::Any).is::<StdClass>()) .unwrap_or(false); let repos: IndexMap<String, Box<PhpMixed>> = repositories_value @@ -1689,7 +1689,9 @@ impl JsonManipulator { pub fn format(&self, data: &PhpMixed, depth: i64, was_object: bool) -> anyhow::Result<String> { let mut data = data.clone(); let mut was_object = was_object; - if data.as_any().is::<StdClass>() || data.as_any().is::<ArrayObject>() { + if (&data as &dyn std::any::Any).is::<StdClass>() + || (&data as &dyn std::any::Any).is::<ArrayObject>() + { // PHP: (array) $data — coerce to array if let Some(obj) = data.as_object() { data = PhpMixed::Array(obj.to_array()); @@ -1761,7 +1763,9 @@ impl ManipulatorFormatter { fn format(&self, data: &PhpMixed, depth: i64, was_object: bool) -> anyhow::Result<String> { let mut data = data.clone(); let mut was_object = was_object; - if data.as_any().is::<StdClass>() || data.as_any().is::<ArrayObject>() { + if (&data as &dyn std::any::Any).is::<StdClass>() + || (&data as &dyn std::any::Any).is::<ArrayObject>() + { if let Some(obj) = data.as_object() { data = PhpMixed::Array(obj.to_array()); } |
