From 78ceacebdf7943eb6e8cb4ea2c64f553acd60a84 Mon Sep 17 00:00:00 2001 From: Justin Sternberg Date: Fri, 30 Oct 2015 14:35:44 -0400 Subject: [PATCH] Use null === vs is_null for consitency and removing marginal function call overhead --- includes/CMB2_Field.php | 2 +- includes/CMB2_Types.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/CMB2_Field.php b/includes/CMB2_Field.php index 1bb293694..255351537 100644 --- a/includes/CMB2_Field.php +++ b/includes/CMB2_Field.php @@ -1042,7 +1042,7 @@ public function _set_field_defaults( $args ) { $args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null; $args['show_option_none'] = true === $args['show_option_none'] ? __( 'None', 'cmb2' ) : $args['show_option_none']; - if ( is_null( $args['show_option_none'] ) ) { + if ( null === $args['show_option_none'] ) { $off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true ); $args['show_option_none'] = $off_by_default ? false : __( 'None', 'cmb2' ); } diff --git a/includes/CMB2_Types.php b/includes/CMB2_Types.php index fb1857764..e6213c32d 100644 --- a/includes/CMB2_Types.php +++ b/includes/CMB2_Types.php @@ -733,7 +733,7 @@ public function checkbox( $args = array(), $is_checked = null ) { $meta_value = $this->field->escaped_value(); - $is_checked = is_null( $is_checked ) + $is_checked = null === $is_checked ? ! empty( $meta_value ) : $is_checked;