get_debug_type() does the same thing but better (spelling type names in the same way as in type declarations, and including names of object classes and resource types). It was added in PHP 8, but the symfony/polyfill-php80 package provides it while we still support 7.4. Also remove uses of get_class() and get_resource_type() where the new method already provides the same information. For reference: https://www.php.net/manual/en/function.get-debug-type.php https://www.php.net/manual/en/function.gettype.php In this commit I'm only changing code where it looks like the result is used only for some king of debug, log, or test output. This probably won't break anything important, but I'm not sure whether anything might depend on the exact values. Change-Id: I7c1f0a8f669228643e86f8e511c0e26a2edb2948
24 lines
463 B
PHP
24 lines
463 B
PHP
<?php
|
|
|
|
namespace Wikimedia\DebugInfo;
|
|
|
|
/**
|
|
* A class used for replacing large objects in var_dump() output.
|
|
*
|
|
* @since 1.40
|
|
*/
|
|
class Placeholder {
|
|
/** @var string A description of the replaced object */
|
|
public $desc;
|
|
|
|
/**
|
|
* @param mixed $value
|
|
*/
|
|
public function __construct( $value ) {
|
|
if ( is_object( $value ) ) {
|
|
$this->desc = get_class( $value ) . '#' . spl_object_id( $value );
|
|
} else {
|
|
$this->desc = get_debug_type( $value );
|
|
}
|
|
}
|
|
}
|