Add support for deprecated actions and filters - #25
Open
daledupreez wants to merge 2 commits into
Open
Conversation
Author
Author
|
And also a bump for @johnbillion, as I can't request a specific reviewer for the PR. Apologies for the ping, but I suspect this may not be a repo you check frequently. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements support for an optional
--include-deprecatedargument that allows deprecated hooks to be included in the generator output. This option is off by default, but a default can be specified via theextrafields incomposer.json.At an implementation level, the PR looks for
do_action_deprecatedandapply_filters_deprecatedfunction calls, and extracts the data from the function arguments in addition to any PHPDoc for the call. For now, I am also allowing call sites with empty PHPDoc to be included by creating some stub document text, as the function arguments include fairly critical information, even if the main PHPDoc does not. But that may not be a great approach, so I am happy to remove that loophole.In particular, the code adds three new fields for deprecated hooks:
deprecated_version- the version the hook was deprecated in, which is extracted from the third argument (index 2) to the hook functiondeprecated_replacement- the name of the replacement (which may or may not be a function), which is extracted from the fourth argument (index 3) to the hook functiondeprecated_message- the value of the message argument, which is extracted from the fifth argument (index 4) to the hook functionThe PR includes updates to the types and the JSON schema, as well as bumping the package and schema versions to 1.1.0 to reflect the opt-in nature of the new feature, as it is backwards compatible for current use cases.