You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script tries to find hook with regexes in all files in a release zip archive, or in a directory (to add hummingbird for example, as it is not yet included in the releases).
Regexes are hard to maintain and hard to write.
The best approach would be to parse the php code with a library to avoid those regexes.
Issues with this script:
Fix some regexes to match hooks in codebase (you must scan all files, and identify where hooks are called)
Fix the name cleaning array (linked with regex matching)
Detect if hooks uses check_exceptions, chain and array_return
I'm still not sure we can match all hooks with regexes against the codebase.
Solution
Another approach would be to refactor the HookFinder with the famous php-parser library which produces AST : https://github.com/nikic/php-parser (the one used by PHPStan to detect bugs).
Possible caveats
Will it parse correctly smarty or twig files ?
The text was updated successfully, but these errors were encountered:
Maintaining hook list in the docs is mandatory, and this list constantly evolves on each:
A PR is currently in draft here: #1741
This script tries to find hook with regexes in all files in a release zip archive, or in a directory (to add hummingbird for example, as it is not yet included in the releases).
Regexes are hard to maintain and hard to write.
The best approach would be to parse the php code with a library to avoid those regexes.
Issues with this script:
check_exceptions
,chain
andarray_return
I'm still not sure we can match all hooks with regexes against the codebase.
Solution
Another approach would be to refactor the
HookFinder
with the famous php-parser library which produces AST : https://github.com/nikic/php-parser (the one used by PHPStan to detect bugs).Possible caveats
The text was updated successfully, but these errors were encountered: