mirror of
git://develop.git.wordpress.org/
synced 2025-04-16 10:02:20 +02:00
General: Remove a few is_object()
checks followed by instanceof
operator.
This is a minor performance enhancement: * If an object is passed, the call to `is_object()` will be redundant. * If a non-object is passed, the `instanceof` operator (a variant of `is_a()`) will first [https://github.com/php/php-src/blob/f42992f/Zend/zend_builtin_functions.c#L630-L631 check if it is an object] before doing any further processing. Therefore, no additional processing cycles should be wasted in both cases. Follow-up to [6779], [48798], [48905], [49194], [55748]. Props Presskopp, costdev. Fixes #58309. git-svn-id: https://develop.svn.wordpress.org/trunk@55757 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
002a3e38dd
commit
f375b68447
@ -1170,8 +1170,8 @@
|
||||
// ----- Reset the error handler
|
||||
$this->privErrorReset();
|
||||
|
||||
// ----- Look if the $p_archive is a PclZip object
|
||||
if (is_object($p_archive) && $p_archive instanceof pclzip)
|
||||
// ----- Look if the $p_archive is an instantiated PclZip object
|
||||
if ($p_archive instanceof pclzip)
|
||||
{
|
||||
|
||||
// ----- Duplicate the archive
|
||||
@ -1234,8 +1234,8 @@
|
||||
return(0);
|
||||
}
|
||||
|
||||
// ----- Look if the $p_archive_to_add is a PclZip object
|
||||
if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip)
|
||||
// ----- Look if the $p_archive_to_add is an instantiated PclZip object
|
||||
if ($p_archive_to_add instanceof pclzip)
|
||||
{
|
||||
|
||||
// ----- Merge the archive
|
||||
|
@ -3748,8 +3748,8 @@ function get_taxonomies_for_attachments( $output = 'names' ) {
|
||||
* Determines whether the value is an acceptable type for GD image functions.
|
||||
*
|
||||
* In PHP 8.0, the GD extension uses GdImage objects for its data structures.
|
||||
* This function checks if the passed value is either a resource of type `gd`
|
||||
* or a GdImage object instance. Any other type will return false.
|
||||
* This function checks if the passed value is either a GdImage object instance
|
||||
* or a resource of type `gd`. Any other type will return false.
|
||||
*
|
||||
* @since 5.6.0
|
||||
*
|
||||
@ -3758,8 +3758,8 @@ function get_taxonomies_for_attachments( $output = 'names' ) {
|
||||
* false otherwise.
|
||||
*/
|
||||
function is_gd_image( $image ) {
|
||||
if ( is_resource( $image ) && 'gd' === get_resource_type( $image )
|
||||
|| is_object( $image ) && $image instanceof GdImage
|
||||
if ( $image instanceof GdImage
|
||||
|| is_resource( $image ) && 'gd' === get_resource_type( $image )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user