docs icon indicating copy to clipboard operation
docs copied to clipboard

Script to extract hooks

Open thomasnares opened this issue 2 years ago • 0 comments

Questions Answers
Branch? 8.x
Description? Cleaned the script to generate hook list, but there are still some bugs on regex.

This script allows to extract hooks for documentation for devdocs, from a release archive, or from a directory

Usage is documented within the script

But it must be finished and fixed:

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).

As the hook list is in perpetual evolution and changes at every release, this should be a priority to fix this script and use it regularely

thomasnares avatar Oct 30 '23 15:10 thomasnares