Feature proposal #7190
openImprove Get array handling
0%
Description
Improve Get array handling to handle more strict dimensional arrays. Examples as follows.
array( GetterInterface::STRING )
The above returns the following IF values exist.
array( 'string', 'string', 'string' )
If no values exist you get the following.
array( 0 => null )
This is due to the $default, which should probably just be returned if no values are found. In short the nested values $default should always be null. If returned value is null then don't add it to the array. If the array is empty then return $default. This would give you the following as the return instead of above.
array()
For multi dimensional arrays the default fallback needs to be applied to sub types. Example as follows. Note the below usage is not used anywhere and can be freely improved without B/C concerns.
array( GetterInterface::STRING, 'type_1' => array( 'subtype_1' => GetterInterface::COMMAND ) )
With the above type_1 array is passed down and has no default. So subtype_1 is casted to command, but other keys in the array aren't casted to anything. The string typing should inherit.