Skip to content

Commit

Permalink
Merge branch 'doing-it-wrong-loops' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed May 22, 2024
2 parents 05d07df + ca4224b commit 672ff20
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions collectors/doing_it_wrong.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class QM_Collector_Doing_It_Wrong extends QM_DataCollector {

public $id = 'doing_it_wrong';

/**
* @var bool
*/
private $collecting = false;

public function get_storage(): QM_Data {
return new QM_Data_Doing_It_Wrong();
}
Expand Down Expand Up @@ -112,6 +117,12 @@ public function get_concerned_filters() {
* @return void
*/
public function action_doing_it_wrong_run( $function_name, $message, $version ) {
if ( $this->collecting ) {
return;
}

$this->collecting = true;

$trace = new QM_Backtrace( array(
'ignore_hook' => array(
current_action() => true,
Expand All @@ -135,6 +146,8 @@ public function action_doing_it_wrong_run( $function_name, $message, $version )
$version
),
);

$this->collecting = false;
}

/**
Expand All @@ -144,6 +157,12 @@ public function action_doing_it_wrong_run( $function_name, $message, $version )
* @return void
*/
public function action_deprecated_function_run( $function_name, $replacement, $version ) {
if ( $this->collecting ) {
return;
}

$this->collecting = true;

$trace = new QM_Backtrace( array(
'ignore_hook' => array(
current_action() => true,
Expand Down Expand Up @@ -173,6 +192,8 @@ public function action_deprecated_function_run( $function_name, $replacement, $v
'component' => $trace->get_component(),
'message' => $message,
);

$this->collecting = false;
}

/**
Expand All @@ -182,6 +203,12 @@ public function action_deprecated_function_run( $function_name, $replacement, $v
* @return void
*/
public function action_deprecated_constructor_run( $class_name, $version, $parent_class ) {
if ( $this->collecting ) {
return;
}

$this->collecting = true;

$trace = new QM_Backtrace( array(
'ignore_hook' => array(
current_action() => true,
Expand Down Expand Up @@ -213,6 +240,8 @@ public function action_deprecated_constructor_run( $class_name, $version, $paren
'component' => $trace->get_component(),
'message' => $message,
);

$this->collecting = false;
}

/**
Expand All @@ -223,6 +252,12 @@ public function action_deprecated_constructor_run( $class_name, $version, $paren
* @return void
*/
public function action_deprecated_file_included( $file, $replacement, $version, $message ) {
if ( $this->collecting ) {
return;
}

$this->collecting = true;

$trace = new QM_Backtrace( array(
'ignore_hook' => array(
current_action() => true,
Expand Down Expand Up @@ -254,6 +289,8 @@ public function action_deprecated_file_included( $file, $replacement, $version,
'component' => $trace->get_component(),
'message' => $message,
);

$this->collecting = false;
}

/**
Expand All @@ -263,6 +300,12 @@ public function action_deprecated_file_included( $file, $replacement, $version,
* @return void
*/
public function action_deprecated_argument_run( $function_name, $message, $version ) {
if ( $this->collecting ) {
return;
}

$this->collecting = true;

$trace = new QM_Backtrace( array(
'ignore_hook' => array(
current_action() => true,
Expand Down Expand Up @@ -292,6 +335,8 @@ public function action_deprecated_argument_run( $function_name, $message, $versi
'component' => $trace->get_component(),
'message' => $message,
);

$this->collecting = false;
}

/**
Expand All @@ -302,6 +347,12 @@ public function action_deprecated_argument_run( $function_name, $message, $versi
* @return void
*/
public function action_deprecated_hook_run( $hook, $replacement, $version, $message ) {
if ( $this->collecting ) {
return;
}

$this->collecting = true;

$trace = new QM_Backtrace( array(
'ignore_hook' => array(
current_action() => true,
Expand Down Expand Up @@ -333,6 +384,8 @@ public function action_deprecated_hook_run( $hook, $replacement, $version, $mess
'component' => $trace->get_component(),
'message' => $message,
);

$this->collecting = false;
}

}
Expand Down

0 comments on commit 672ff20

Please sign in to comment.