diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-20 18:34:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-20 18:34:54 +0900 |
| commit | 81b9fc9d92bb74aa8428ae4db39bd84e8c16095c (patch) | |
| tree | 3efb6476d797e2a95545c4c3abba468c3e3c8d52 /crates/shirabe/src/json/json_file.rs | |
| parent | c09cd630afb4bb0ca10e926f93bf706ca828ae85 (diff) | |
| download | php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.gz php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.zst php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.zip | |
refactor(php-shim): drop Box wrapping from PhpMixed List/Array
The List and Array variants of PhpMixed boxed their elements
unnecessarily. Store PhpMixed values directly and update all callers
accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/json/json_file.rs')
| -rw-r--r-- | crates/shirabe/src/json/json_file.rs | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index 22b104b..167a163 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -352,15 +352,10 @@ impl JsonFile { // A string-keyed `PhpMixed::Array` serializes as a JSON object, matching the (object) cast. let mut schema_data: PhpMixed = { let mut m = indexmap::IndexMap::new(); - m.insert( - "$ref".to_string(), - Box::new(PhpMixed::String(schema_file.clone())), - ); + m.insert("$ref".to_string(), PhpMixed::String(schema_file.clone())); m.insert( "$schema".to_string(), - Box::new(PhpMixed::String( - "https://json-schema.org/draft-04/schema#".to_string(), - )), + PhpMixed::String("https://json-schema.org/draft-04/schema#".to_string()), ); PhpMixed::Array(m) }; @@ -368,32 +363,24 @@ impl JsonFile { if schema == Self::STRICT_SCHEMA && is_composer_schema_file { schema_data = json_decode(&file_get_contents(&schema_file).unwrap_or_default(), false)?; if let PhpMixed::Array(map) = &mut schema_data { - map.insert( - "additionalProperties".to_string(), - Box::new(PhpMixed::Bool(false)), - ); + map.insert("additionalProperties".to_string(), PhpMixed::Bool(false)); map.insert( "required".to_string(), - Box::new(PhpMixed::List(vec![ - Box::new(PhpMixed::String("name".to_string())), - Box::new(PhpMixed::String("description".to_string())), - ])), + PhpMixed::List(vec![ + PhpMixed::String("name".to_string()), + PhpMixed::String("description".to_string()), + ]), ); } } else if schema == Self::AUTH_SCHEMA && is_composer_schema_file { let mut m = indexmap::IndexMap::new(); m.insert( "$ref".to_string(), - Box::new(PhpMixed::String(format!( - "{}#/properties/config", - schema_file, - ))), + PhpMixed::String(format!("{}#/properties/config", schema_file,)), ); m.insert( "$schema".to_string(), - Box::new(PhpMixed::String( - "https://json-schema.org/draft-04/schema#".to_string(), - )), + PhpMixed::String("https://json-schema.org/draft-04/schema#".to_string()), ); schema_data = PhpMixed::Array(m); } |
