Skip to content

Commit

Permalink
ValidHookName: minor efficiency tweaks (#1815)
Browse files Browse the repository at this point in the history
ValidHookName: minor efficiency tweaks
  • Loading branch information
GaryJones committed Oct 27, 2019
2 parents d803011 + 0e88b83 commit 1563450
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ class ValidHookNameSniff extends AbstractFunctionParameterSniff {
*/
public function getGroups() {
$this->target_functions = $this->hookInvokeFunctions;

// No need to examine the names of deprecated hooks.
unset(
$this->target_functions['do_action_deprecated'],
$this->target_functions['apply_filters_deprecated']
);

return parent::getGroups();
}

Expand All @@ -89,14 +96,6 @@ public function getGroups() {
* @return void
*/
public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) {
// Ignore deprecated hook names.
if ( strpos( $matched_content, '_deprecated' ) > 0 ) {
return;
}

if ( ! isset( $parameters[1] ) ) {
return;
}

$regex = $this->prepare_regex();

Expand Down

0 comments on commit 1563450

Please sign in to comment.