mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Coding Standards: Use instanceof keyword instead of the is_a() function.
This is a micro-optimization that removes a few unnecessary function calls. Follow-up to [31188], [34369], [38986], [41159], [43211], [43230], [44606], [45757]. Props ayeshrajans, jrf, rajinsharwar, costdev, mukesh27, SergeyBiryukov. Fixes #58943. git-svn-id: https://develop.svn.wordpress.org/trunk@56352 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f8b4e2c184
commit
b92491b8d2
@ -140,7 +140,7 @@ endif;
|
||||
* @param int $id Front page section to display.
|
||||
*/
|
||||
function twentyseventeen_front_page_section( $partial = null, $id = 0 ) {
|
||||
if ( is_a( $partial, 'WP_Customize_Partial' ) ) {
|
||||
if ( $partial instanceof WP_Customize_Partial ) {
|
||||
// Find out the ID and set it up during a selective refresh.
|
||||
global $twentyseventeencounter;
|
||||
|
||||
|
||||
@ -897,7 +897,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||
)
|
||||
);
|
||||
}
|
||||
} elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) {
|
||||
} elseif ( $current_object instanceof WP_User && current_user_can( 'edit_user', $current_object->ID ) ) {
|
||||
$edit_user_link = get_edit_user_link( $current_object->ID );
|
||||
if ( $edit_user_link ) {
|
||||
$wp_admin_bar->add_node(
|
||||
|
||||
@ -354,7 +354,7 @@ function wp_remote_retrieve_cookie( $response, $name ) {
|
||||
function wp_remote_retrieve_cookie_value( $response, $name ) {
|
||||
$cookie = wp_remote_retrieve_cookie( $response, $name );
|
||||
|
||||
if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) {
|
||||
if ( ! ( $cookie instanceof WP_Http_Cookie ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@ -4032,7 +4032,7 @@ function _wp_privacy_account_request_confirmed( $request_id ) {
|
||||
function _wp_privacy_send_request_confirmation_notification( $request_id ) {
|
||||
$request = wp_get_user_request( $request_id );
|
||||
|
||||
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
|
||||
if ( ! ( $request instanceof WP_User_Request ) || 'request-confirmed' !== $request->status ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4244,7 +4244,7 @@ All at ###SITENAME###
|
||||
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
|
||||
$request = wp_get_user_request( $request_id );
|
||||
|
||||
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
|
||||
if ( ! ( $request instanceof WP_User_Request ) || 'request-completed' !== $request->status ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1303,7 +1303,7 @@ switch ( $action ) {
|
||||
}
|
||||
|
||||
// Check if it is time to add a redirect to the admin email confirmation screen.
|
||||
if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) {
|
||||
if ( $user instanceof WP_User && $user->exists() && $user->has_cap( 'manage_options' ) ) {
|
||||
$admin_email_lifespan = (int) get_option( 'admin_email_lifespan' );
|
||||
|
||||
/*
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
abstract class WP_Test_REST_TestCase extends WP_UnitTestCase {
|
||||
protected function assertErrorResponse( $code, $response, $status = null ) {
|
||||
|
||||
if ( is_a( $response, 'WP_REST_Response' ) ) {
|
||||
if ( $response instanceof WP_REST_Response ) {
|
||||
$response = $response->as_error();
|
||||
}
|
||||
|
||||
|
||||
@ -535,7 +535,7 @@ class Tests_Actions extends WP_UnitTestCase {
|
||||
foreach ( $hook as $priority => $filter ) {
|
||||
foreach ( $filter as $identifier => $function ) {
|
||||
if ( is_array( $function )
|
||||
&& is_a( $function['function'][0], 'MockAction' )
|
||||
&& $function['function'][0] instanceof MockAction
|
||||
&& 'action' === $function['function'][1]
|
||||
) {
|
||||
remove_filter(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user