Skip to content

Commit

Permalink
Use isset instead of array_key_exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Sep 25, 2023
1 parent 271b54d commit dc2626d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ function get_hooked_blocks( $name ) {
if ( $anchor_block_type !== $name ) {
continue;
}
if ( ! array_key_exists( $relative_position, $hooked_blocks ) ) {
if ( ! isset( $hooked_blocks[ $relative_position ] ) ) {
$hooked_blocks[ $relative_position ] = array();
}
$hooked_blocks[ $relative_position ][] = $block_type->name;
Expand Down Expand Up @@ -805,7 +805,7 @@ function make_before_block_visitor( $context ) {
$anchor_block_type = $parent['blockName'];
$hooked_block_types = get_hooked_blocks( $anchor_block_type );

if ( array_key_exists( $relative_position, $hooked_block_types ) ) {
if ( isset( $hooked_block_types[ $relative_position ] ) ) {
$hooked_block_types = $hooked_block_types[ $relative_position ];
} else {
$hooked_block_types = array();
Expand All @@ -832,7 +832,7 @@ function make_before_block_visitor( $context ) {
$anchor_block_type = $block['blockName'];
$hooked_block_types = get_hooked_blocks( $anchor_block_type );

if ( array_key_exists( $relative_position, $hooked_block_types ) ) {
if ( isset( $hooked_block_types[ $relative_position ] ) ) {
$hooked_block_types = $hooked_block_types[ $relative_position ];
} else {
$hooked_block_types = array();
Expand Down Expand Up @@ -881,7 +881,7 @@ function make_after_block_visitor( $context ) {
$anchor_block_type = $block['blockName'];
$hooked_block_types = get_hooked_blocks( $anchor_block_type );

if ( array_key_exists( $relative_position, $hooked_block_types ) ) {
if ( isset( $hooked_block_types[ $relative_position ] ) ) {
$hooked_block_types = $hooked_block_types[ $relative_position ];
} else {
$hooked_block_types = array();
Expand All @@ -899,7 +899,7 @@ function make_after_block_visitor( $context ) {
$anchor_block_type = $parent['blockName'];
$hooked_block_types = get_hooked_blocks( $anchor_block_type );

if ( array_key_exists( $relative_position, $hooked_block_types ) ) {
if ( isset( $hooked_block_types[ $relative_position ] ) ) {
$hooked_block_types = $hooked_block_types[ $relative_position ];
} else {
$hooked_block_types = array();
Expand Down

0 comments on commit dc2626d

Please sign in to comment.