Skip to content

Commit

Permalink
Merge pull request #6 from timber/fix-hook-reference-generator
Browse files Browse the repository at this point in the history
fix: Fix a bug when hook reference returned empty
  • Loading branch information
gchtr authored Jul 3, 2024
2 parents 119e2ed + 4a07ec6 commit 5c6e8cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Compiler/HookReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function parse()
}

$this->lastDocBlock = $docBlock;
} elseif (T_STRING === $type && $this->isHook($contents)) {
} elseif (!empty(trim($contents)) && $this->isHook($contents)) {
$hookName = $this->findNextHookName($tokens, $key);

if ($this->isValidHook($hookName)) {
Expand Down Expand Up @@ -209,6 +209,9 @@ private function isHook($name)
'do_action_deprecated',
);

// Remove any leading backslashes.
$name = ltrim($name, '\\');

return in_array($name, $functions);
}

Expand Down

0 comments on commit 5c6e8cd

Please sign in to comment.