diff --git a/src/Event/Core_Events.php b/src/Event/Core_Events.php index e4fa390..9e03a85 100644 --- a/src/Event/Core_Events.php +++ b/src/Event/Core_Events.php @@ -14,13 +14,13 @@ class Core_Events implements Hook_Event_Config_Interface { public function get_events(): array { return [ - [ 'Plugins Load', 'plugin', null, 'plugins_loaded', - 1, - 2 ], + [ 'Plugins Load', 'plugin', '', 'plugins_loaded', - 1, - 2 ], [ 'Plugins Loaded Hook', 'plugin', 'plugins_loaded' ], [ 'Themes Load', 'theme', 'setup_theme', 'after_setup_theme' ], [ 'Core Init', 'core', 'init', 'wp_loaded' ], [ 'Admin Init', 'core', 'admin_init' ], [ 'Admin Menu', 'core', '_admin_menu', 'admin_menu' ], - [ 'Toolbar', 'core', 'admin_bar_menu', null ], + [ 'Toolbar', 'core', 'admin_bar_menu', '' ], [ 'Main Loop', 'theme', 'loop_start', 'loop_end' ], [ 'Admin Print Scripts', 'core', 'admin_enqueue_scripts', 'admin_print_scripts' ], ]; diff --git a/src/Record/Hook_Record_Collector.php b/src/Record/Hook_Record_Collector.php index 564a8f4..aadd98d 100644 --- a/src/Record/Hook_Record_Collector.php +++ b/src/Record/Hook_Record_Collector.php @@ -66,15 +66,15 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector { * * @param string $event Hook event name. * @param string $category Hook event category. - * @param string|null $start Start hook name. Pass null to ignore. - * @param string|null $stop Stop hook name (defaults to start name). + * @param string $start Start hook 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 $stop_priority Stop hook priority (defaults to max int). */ private function add_event( string $event, string $category, - ?string $start = null, + string $start, ?string $stop = null, int $start_priority = - 1, int $stop_priority = PHP_INT_MAX @@ -85,7 +85,7 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector { $collector = $this; - if ( null !== $start ) { + if ( '' !== $start ) { add_action( $start, function ( $input = null ) use ( $collector, $event, $category ) { $collector->start( $event, $category ); @@ -93,7 +93,7 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector { }, $start_priority ); } - if ( null !== $stop ) { + if ( '' !== $stop ) { add_action( $stop, function ( $input = null ) use ( $collector, $event ) { $collector->stop( $event );