Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
588b597f99 | ||
|
|
54ba716ba8 | ||
|
|
e2f85f44d2 | ||
|
|
a2ae665dd2 | ||
|
|
f8f5e436e5 | ||
|
|
6cab9bbd6b | ||
|
|
1e9a600096 | ||
|
|
cc1cdc577a | ||
|
|
d3e352d9f3 |
No files matched your search
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 3.3.1 - 2019-07-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- crash from broken plugin loaded hook input from global
|
||||||
|
|
||||||
## 3.3 - 2019-03-27
|
## 3.3 - 2019-03-27
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ It provides a visual summary in toolbar that is quick and easy to inspect.
|
|||||||
|
|
||||||
Laps automatically tracks many events, such as:
|
Laps automatically tracks many events, such as:
|
||||||
- PHP, core, plugins, and themes load, main posts loop, sidebars
|
- PHP, core, plugins, and themes load, main posts loop, sidebars
|
||||||
- database queries (with [`SAVEQUERIES` constant](http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis) enabled)
|
- database queries (with [`SAVEQUERIES` defined constant set to true](https://wordpress.org/support/article/editing-wp-config-php/#save-queries-for-analysis))
|
||||||
- network requests to other sites
|
- network requests to other sites
|
||||||
|
|
||||||
## API profiling
|
## API profiling
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Plugin Name: Laps
|
|||||||
Plugin URI: https://github.com/Rarst/laps
|
Plugin URI: https://github.com/Rarst/laps
|
||||||
Description: Light WordPress profiler.
|
Description: Light WordPress profiler.
|
||||||
Author: Andrey “Rarst” Savchenko
|
Author: Andrey “Rarst” Savchenko
|
||||||
Version: 3.3
|
Version: 3.3.1
|
||||||
Author URI: https://www.rarst.net/
|
Author URI: https://www.rarst.net/
|
||||||
Text Domain: laps
|
Text Domain: laps
|
||||||
Domain Path: /lang
|
Domain Path: /lang
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<psalm
|
<psalm
|
||||||
totallyTyped="true"
|
totallyTyped="false"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
@@ -16,28 +16,7 @@
|
|||||||
<issueHandlers>
|
<issueHandlers>
|
||||||
<LessSpecificReturnType errorLevel="info"/>
|
<LessSpecificReturnType errorLevel="info"/>
|
||||||
<UndefinedFunction errorLevel="suppress"/>
|
<UndefinedFunction errorLevel="suppress"/>
|
||||||
<UndefinedClass>
|
<UndefinedClass errorLevel="suppress"/>
|
||||||
<errorLevel type="suppress">
|
<UndefinedDocblockClass errorLevel="suppress"/>
|
||||||
<referencedClass name="WP_Admin_Bar"/>
|
|
||||||
<referencedClass name="WP_Error"/>
|
|
||||||
<referencedClass name="WP_Hook"/>
|
|
||||||
</errorLevel>
|
|
||||||
</UndefinedClass>
|
|
||||||
<MixedArgument>
|
|
||||||
<errorLevel type="suppress">
|
|
||||||
<file name="src/Provider/Record_Provider.php" />
|
|
||||||
<file name="src/Record/Collector/Hook_Collector.php" />
|
|
||||||
</errorLevel>
|
|
||||||
</MixedArgument>
|
|
||||||
<MissingClosureParamType>
|
|
||||||
<errorLevel type="suppress">
|
|
||||||
<file name="src/Record/Collector/Hook_Collector.php" />
|
|
||||||
</errorLevel>
|
|
||||||
</MissingClosureParamType>
|
|
||||||
<MissingClosureReturnType>
|
|
||||||
<errorLevel type="suppress">
|
|
||||||
<file name="src/Record/Collector/Hook_Collector.php" />
|
|
||||||
</errorLevel>
|
|
||||||
</MissingClosureReturnType>
|
|
||||||
</issueHandlers>
|
</issueHandlers>
|
||||||
</psalm>
|
</psalm>
|
||||||
@@ -9,7 +9,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class Core_Events implements Hook_Event_Config_Interface {
|
class Core_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class Extension_Events implements Hook_Event_Config_Interface {
|
class Extension_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array[]
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ class Extension_Events implements Hook_Event_Config_Interface {
|
|||||||
/**
|
/**
|
||||||
* Beaver Builder events.
|
* Beaver Builder events.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
private function beaver_builder(): array {
|
private function beaver_builder(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class Genesis_Events implements Hook_Event_Config_Interface {
|
class Genesis_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class Hybrid_Events implements Hook_Event_Config_Interface {
|
class Hybrid_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class THA_Events implements Hook_Event_Config_Interface {
|
class THA_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class WooCommerce_Events implements Hook_Event_Config_Interface {
|
class WooCommerce_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Rarst\Laps\Event;
|
|||||||
class Yoast_Events implements Hook_Event_Config_Interface {
|
class Yoast_Events implements Hook_Event_Config_Interface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class Backtrace_Formatter {
|
|||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @psalm-suppress PossiblyFalseOperand
|
* @psalm-suppress PossiblyFalseOperand
|
||||||
* @psalm-suppress MixedInferredReturnType
|
|
||||||
*/
|
*/
|
||||||
protected function shorten_include( string $item ): string {
|
protected function shorten_include( string $item ): string {
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,14 @@ class Hook_Formatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @psalm-type Callback = string|object|array
|
||||||
|
* @psalm-type AcceptedArgs = int
|
||||||
|
* @psalm-type Hook = array{function: Callback, accepted_args: AcceptedArgs}
|
||||||
|
* @psalm-type Priority = array-key
|
||||||
|
* @psalm-type Hooks = array<Priority, array<Hook>>
|
||||||
|
*
|
||||||
* @param \WP_Hook|array $hook Hook instance.
|
* @param \WP_Hook|array $hook Hook instance.
|
||||||
|
* @psalm-param \WP_Hook|Hooks $hook
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -34,6 +41,7 @@ class Hook_Formatter {
|
|||||||
$callbacks = [];
|
$callbacks = [];
|
||||||
|
|
||||||
if ( $hook instanceof \WP_Hook ) {
|
if ( $hook instanceof \WP_Hook ) {
|
||||||
|
/** @psalm-var Hooks $hook->callbacks */
|
||||||
$hook = $hook->callbacks;
|
$hook = $hook->callbacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,27 +69,27 @@ class Hook_Formatter {
|
|||||||
/**
|
/**
|
||||||
* @param string|object|array $callback Hook callback.
|
* @param string|object|array $callback Hook callback.
|
||||||
* @param int $args Number of accepted arguments.
|
* @param int $args Number of accepted arguments.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function get_callback_name( $callback, int $args ): string {
|
protected function get_callback_name( $callback, int $args ): string {
|
||||||
|
|
||||||
switch ( gettype( $callback ) ) {
|
switch ( gettype( $callback ) ) {
|
||||||
case 'object':
|
case 'object':
|
||||||
$callback = $this->get_class_name( $callback );
|
$name = $this->get_class_name( $callback );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'array':
|
case 'array':
|
||||||
|
/** @psalm-var array{0: object|string, 1: string} $callback */
|
||||||
$class = is_string( $callback[0] )
|
$class = is_string( $callback[0] )
|
||||||
? $callback[0] . '::'
|
? $callback[0] . '::'
|
||||||
: $this->get_class_name( $callback[0] ) . '->';
|
: $this->get_class_name( $callback[0] ) . '->';
|
||||||
$callback = $class . $callback[1];
|
$name = $class . $callback[1];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$name = $callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
$callback .= ( 1 === $args ) ? '' : "({$args})";
|
return $name . ( ( 1 === $args ) ? '' : "({$args})" );
|
||||||
|
|
||||||
return $callback;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +99,7 @@ class Hook_Formatter {
|
|||||||
*/
|
*/
|
||||||
protected function get_class_name( $object ): string {
|
protected function get_class_name( $object ): string {
|
||||||
|
|
||||||
if ( is_a( $object, 'CLosure' ) ) {
|
if ( $object instanceof \Closure ) {
|
||||||
$class = new \ReflectionFunction( $object );
|
$class = new \ReflectionFunction( $object );
|
||||||
|
|
||||||
return 'closure from ' . $this->shorten_path( $class->getFileName() ) . ':' . $class->getStartLine();
|
return 'closure from ' . $this->shorten_path( $class->getFileName() ) . ':' . $class->getStartLine();
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ class Load_Order_Manager {
|
|||||||
* Reorder active plugins so Laps is first and starts timing load early.
|
* Reorder active plugins so Laps is first and starts timing load early.
|
||||||
*
|
*
|
||||||
* @param array $plugins Filtered array of active plugins’ basenames.
|
* @param array $plugins Filtered array of active plugins’ basenames.
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function pre_update_option_active_plugins( array $plugins ): array {
|
public function pre_update_option_active_plugins( array $plugins ): array {
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ class Toolbar_Manager {
|
|||||||
* Render interface and add to the toolbar.
|
* Render interface and add to the toolbar.
|
||||||
*
|
*
|
||||||
* @param \WP_Admin_Bar $wp_admin_bar WordPress core toolbar object.
|
* @param \WP_Admin_Bar $wp_admin_bar WordPress core toolbar object.
|
||||||
*
|
|
||||||
* @psalm-suppress MixedArgument
|
|
||||||
*/
|
*/
|
||||||
public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ): void {
|
public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ): void {
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -20,9 +20,7 @@ class Plugin extends Container {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $values Configuration values to apply.
|
* @param array $values Configuration values to apply.
|
||||||
*
|
* @psalm-param array<string, mixed> $values
|
||||||
* @psalm-suppress MixedArgument
|
|
||||||
* @psalm-suppress MixedAssignment
|
|
||||||
*/
|
*/
|
||||||
public function __construct( array $values = [] ) {
|
public function __construct( array $values = [] ) {
|
||||||
|
|
||||||
@@ -63,8 +61,6 @@ class Plugin extends Container {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks.
|
* Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks.
|
||||||
*
|
|
||||||
* @psalm-suppress MixedAssignment
|
|
||||||
*/
|
*/
|
||||||
public function run(): void {
|
public function run(): void {
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class Hook_Event_Provider implements ServiceProviderInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Container $pimple Container instance.
|
* @param Container $pimple Container instance.
|
||||||
|
*
|
||||||
|
* @psalm-suppress DeprecatedClass
|
||||||
*/
|
*/
|
||||||
public function register( Container $pimple ): void {
|
public function register( Container $pimple ): void {
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,19 @@ class Hook_Collector extends Stopwatch_Collector {
|
|||||||
/** @var array $events */
|
/** @var array $events */
|
||||||
protected $events = [];
|
protected $events = [];
|
||||||
|
|
||||||
/** @var array */
|
/**
|
||||||
|
* @var array $callbacks
|
||||||
|
* @psalm-var array<string, \WP_Hook> $callbacks
|
||||||
|
*/
|
||||||
protected $callbacks = [];
|
protected $callbacks = [];
|
||||||
|
|
||||||
/** @var Hook_Formatter */
|
/** @var Hook_Formatter */
|
||||||
protected $formatter;
|
protected $formatter;
|
||||||
|
|
||||||
/** @var array $calls Tracks number of calls for recurrent events. */
|
/**
|
||||||
|
* @var array $calls Tracks number of calls for recurrent events.
|
||||||
|
* @psalm-var array<string, int> $calls
|
||||||
|
*/
|
||||||
private $calls = [];
|
private $calls = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +61,7 @@ class Hook_Collector extends Stopwatch_Collector {
|
|||||||
/**
|
/**
|
||||||
* Time the point between network/MU plugins and regular if network activated.
|
* Time the point between network/MU plugins and regular if network activated.
|
||||||
*/
|
*/
|
||||||
public function muplugins_loaded() {
|
public function muplugins_loaded(): void {
|
||||||
$this->stop( 'Network & MU Plugins Load' );
|
$this->stop( 'Network & MU Plugins Load' );
|
||||||
$this->start( 'Plugins Load', 'plugin' );
|
$this->start( 'Plugins Load', 'plugin' );
|
||||||
}
|
}
|
||||||
@@ -72,11 +78,11 @@ class Hook_Collector extends Stopwatch_Collector {
|
|||||||
/**
|
/**
|
||||||
* @var int|string $key
|
* @var int|string $key
|
||||||
* @var array $data
|
* @var array $data
|
||||||
|
* @psalm-var array{0:string} $data
|
||||||
*/
|
*/
|
||||||
foreach ( $stops as $key => $data ) {
|
foreach ( $stops as $key => $data ) {
|
||||||
|
|
||||||
if ( is_int( $key ) ) {
|
if ( is_int( $key ) ) {
|
||||||
/** @var array{0:string} $data */
|
|
||||||
$this->add_event( ...$data );
|
$this->add_event( ...$data );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -97,6 +103,9 @@ class Hook_Collector extends Stopwatch_Collector {
|
|||||||
* @param string|null $stop Stop hook name (defaults to start name). Pass empty string to ignore.
|
* @param string|null $stop Stop hook name (defaults to start name). Pass empty string to ignore.
|
||||||
* @param int $start_priority Start hook priority (defaults to -1).
|
* @param int $start_priority Start hook priority (defaults to -1).
|
||||||
* @param int $stop_priority Stop hook priority (defaults to max int).
|
* @param int $stop_priority Stop hook priority (defaults to max int).
|
||||||
|
*
|
||||||
|
* @psalm-suppress MissingClosureReturnType
|
||||||
|
* @psalm-suppress MissingClosureParamType
|
||||||
*/
|
*/
|
||||||
private function add_event(
|
private function add_event(
|
||||||
string $event,
|
string $event,
|
||||||
@@ -112,15 +121,17 @@ class Hook_Collector extends Stopwatch_Collector {
|
|||||||
|
|
||||||
if ( '' !== $start ) {
|
if ( '' !== $start ) {
|
||||||
add_action( $start, function ( $input = null ) use ( $event, $category, $start, $stop ) {
|
add_action( $start, function ( $input = null ) use ( $event, $category, $start, $stop ) {
|
||||||
|
global $wp_filter;
|
||||||
|
|
||||||
$event .= $this->get_count_suffix( $event, true );
|
$event .= $this->get_count_suffix( $event, true );
|
||||||
|
|
||||||
if ( 'Sidebar' === $event ) {
|
if ( 'Sidebar' === $event ) {
|
||||||
|
/** @var string $input */
|
||||||
$event = $input;
|
$event = $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $start === $stop ) {
|
if ( $start === $stop ) {
|
||||||
global $wp_filter;
|
/** @psalm-var array<string, \WP_Hook> $wp_filter */
|
||||||
$this->callbacks[ $event ] = $wp_filter[ $start ];
|
$this->callbacks[ $event ] = $wp_filter[ $start ];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +147,7 @@ class Hook_Collector extends Stopwatch_Collector {
|
|||||||
$event .= $this->get_count_suffix( $event );
|
$event .= $this->get_count_suffix( $event );
|
||||||
|
|
||||||
if ( 'Sidebar' === $event ) {
|
if ( 'Sidebar' === $event ) {
|
||||||
|
/** @var string $input */
|
||||||
$event = $input;
|
$event = $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ class Http_Collector extends Stopwatch_Collector {
|
|||||||
/** @var Backtrace_Formatter */
|
/** @var Backtrace_Formatter */
|
||||||
private $formatter;
|
private $formatter;
|
||||||
|
|
||||||
/** @var array */
|
/**
|
||||||
|
* @var array $callers
|
||||||
|
* @psalm-var array<string, string> $callers
|
||||||
|
*/
|
||||||
private $callers = [];
|
private $callers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +42,7 @@ class Http_Collector extends Stopwatch_Collector {
|
|||||||
* @param array $args HTTP request arguments.
|
* @param array $args HTTP request arguments.
|
||||||
* @param string $url The request URL.
|
* @param string $url The request URL.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return false|array|\WP_Error
|
||||||
*/
|
*/
|
||||||
public function pre_http_request( $false, array $args, string $url ) {
|
public function pre_http_request( $false, array $args, string $url ) {
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,16 @@ class Plugin_Load_Collector implements Record_Collector_Interface {
|
|||||||
*
|
*
|
||||||
* @param string $plugin Plugin file path.
|
* @param string $plugin Plugin file path.
|
||||||
*/
|
*/
|
||||||
public function plugin_loaded( string $plugin ): void {
|
public function plugin_loaded( $plugin ): void {
|
||||||
|
|
||||||
$time = microtime( true );
|
$time = microtime( true );
|
||||||
|
|
||||||
|
if ( ! is_string( $plugin ) ) { // Broken hook input from global.
|
||||||
|
$this->last = $time;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->entries[] = [
|
$this->entries[] = [
|
||||||
'name' => $plugin,
|
'name' => $plugin,
|
||||||
'origin' => $this->last,
|
'origin' => $this->last,
|
||||||
@@ -54,10 +61,8 @@ class Plugin_Load_Collector implements Record_Collector_Interface {
|
|||||||
* Converts recorded information into a Record instance.
|
* Converts recorded information into a Record instance.
|
||||||
*
|
*
|
||||||
* @param array $entry Data entry for the plugin.
|
* @param array $entry Data entry for the plugin.
|
||||||
*
|
|
||||||
* @return Record_Interface
|
|
||||||
*/
|
*/
|
||||||
private function create_record( array $entry ): Record_Interface {
|
private function create_record( array $entry ): Record {
|
||||||
return new Record(
|
return new Record(
|
||||||
plugin_basename( $entry['name'] ),
|
plugin_basename( $entry['name'] ),
|
||||||
$entry['origin'],
|
$entry['origin'],
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use Rarst\Laps\Record\Record;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes SQL events from data logged by wpdb.
|
* Processes SQL events from data logged by wpdb.
|
||||||
|
*
|
||||||
|
* @template QueryData as array{0: string, 1: float, 2: string, 3: float}
|
||||||
*/
|
*/
|
||||||
class Sql_Collector implements Record_Collector_Interface {
|
class Sql_Collector implements Record_Collector_Interface {
|
||||||
|
|
||||||
@@ -35,8 +37,6 @@ class Sql_Collector implements Record_Collector_Interface {
|
|||||||
* @param string $query SQL query.
|
* @param string $query SQL query.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
|
||||||
* @psalm-suppress MixedPropertyFetch
|
|
||||||
*/
|
*/
|
||||||
public function query( $query ): string {
|
public function query( $query ): string {
|
||||||
|
|
||||||
@@ -64,6 +64,7 @@ class Sql_Collector implements Record_Collector_Interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var array $wpdb->queries */
|
/** @var array $wpdb->queries */
|
||||||
|
/** @psalm-var array<int, QueryData> $wpdb->queries */
|
||||||
$records = array_filter( array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries ) );
|
$records = array_filter( array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries ) );
|
||||||
|
|
||||||
return $records;
|
return $records;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class Stopwatch_Collector implements Record_Collector_Interface {
|
|||||||
*/
|
*/
|
||||||
public function get_records(): array {
|
public function get_records(): array {
|
||||||
|
|
||||||
|
/** @psalm-var array<string, StopwatchEvent> $events */
|
||||||
$events = $this->stopwatch->getSectionEvents( '__root__' );
|
$events = $this->stopwatch->getSectionEvents( '__root__' );
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
|
|||||||
Reference in new issue
Block a user