-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor code tweaks/optimizations (PHP) #43375
Conversation
// Determine if any border related features are supported. | ||
$has_border_support = block_has_support( $block_type, array( '__experimentalBorder' ) ); | ||
$has_border_color_support = gutenberg_has_border_feature_support( $block_type, 'color' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are only used once, so we don't need to assign them to a var.
@@ -48,9 +44,7 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) { | |||
return array(); | |||
} | |||
|
|||
$sides = array( 'top', 'right', 'bottom', 'left' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sides
is only used once, no need to assign it to a var
$color_support = false; | ||
if ( property_exists( $block_type, 'supports' ) ) { | ||
$color_support = _wp_array_get( $block_type->supports, array( 'color' ), false ); | ||
} | ||
$color_support = property_exists( $block_type, 'supports' ) ? _wp_array_get( $block_type->supports, array( 'color' ), false ) : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short and sweet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks Ari!
What?
Just some minor code optimizations. Details in comments for each change.