Changes between Version 1 and Version 2 of Ticket #51461, comment 11
- Timestamp:
- 10/15/2020 03:15:32 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #51461, comment 11
v1 v2 6 6 }}} 7 7 8 In a PHP7+ world, `wp_array_get( $block->supports, 'field', false )` could be replaced with `$block->supports['field'] ?? false` (which seems far easier to read than this function, same as the isset() is easier to understand)8 In a PHP7+ world, `wp_array_get( $block->supports, array( 'field' ), false )` could be replaced with `$block->supports['field'] ?? false` (which seems far easier to read than this function, same as the isset() is easier to understand) 9 9 10 There's also an edge oddity around null values (that while not used in core, might present in others usage of it) such that `wp_array_get( [ 'key' => null ], 'key', true )` returns `true` as the key isn't considered set in the input. Perhaps that would be thought of as expected behaviour. 10 There's also an edge oddity around null values (that while not used in core, might present in others usage of it) such that `wp_array_get( [ 'key' => null ], [ 'key' ], true )` returns `true` as the key isn't considered set in the input. Perhaps that would be thought of as expected behaviour. 11 12 ''edit: had to add array syntax around the `$path` var param in examples which I missed.''