Added support for dictionary info_plist values#6
Added support for dictionary info_plist values#6wellspringapps wants to merge 1 commit intoNativePHP:mainfrom
Conversation
shanerbaner82
left a comment
There was a problem hiding this comment.
Nice work — this fills a real gap in plist handling. A few things I'd like to see addressed before merging:
Formatting / Output
-
Inconsistent indentation — nested
<dict>and<array>tags all use\n\tregardless of depth. At 3+ levels deep the output won't match proper plist indentation. Consider passing a$depthparameter through the recursion to control tab count. -
Bool output is inconsistent —
<true />has a trailing\n\tbut<false />doesn't. Also Apple's canonical format is<true/>/<false/>(no space before/>) — we should match that.
Edge Cases
-
Empty array handling —
array_key_first()returnsnullon an empty array, and!is_int(null)evaluates totrue, so an empty array[]would be treated as a dict. Add a guard for this. -
Missing integer/real support — plist also has
<integer>and<real>types. If this is meant to be the comprehensive type handler, those should be covered (or at minimum, numeric values shouldn't silently become<string>).
Code Quality
-
No type hints —
handlePlistTypes($key, $value)is missing type declarations. The rest of the codebase uses them — this should match. -
substituteEnvPlaceholdersonly runs on leaf strings — works for values, but if a placeholder ever appears in a key name it won't get substituted. Worth noting or handling.
Tests
-
No bool assertion — the test sets
UIApplicationSupportsMultipleScenes => truebut never asserts that<true/>appears in the output. Should verify bool rendering actually works. -
Assertions are too shallow —
assertStringContainsStringfor a few key names doesn't validate the actual XML structure or nesting. Consider asserting on the structural tags (<dict>,<array>,<true/>) and/or their relative positions.
Summary
The plist merge in the iOS compile only supports strings and arrays. There are features the require dictionary and boolean values in the plist file.
Solution
The change was to add a method to handle all the types (String, Array, Dictionary, and Bool).
Changes
it_handles_various_plist_value_typeswith all the types