Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #51461, comment 11


Ignore:
Timestamp:
10/15/2020 03:15:32 AM (4 years ago)
Author:
dd32
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #51461, comment 11

    v1 v2  
    66}}}
    77
    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)
     8In 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)
    99
    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.
     10There'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.''