-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce checks against redeclaration for functions and classes #52696
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
6cccfb4
Add Gutenberg coding standards package.
anton-vlasenko 81b0852
Fix contributors.
anton-vlasenko 6ebaf07
Fix package names.
anton-vlasenko 887fab8
Remove unneccessary section.
anton-vlasenko d91104d
Add Gutenberg coding standards package as a composer dependency.
anton-vlasenko 3e7fa24
Add myself as a code owner of the coding standards package.
anton-vlasenko 37a7273
Exclude gutenberg coding standards from PHPCS checks.
anton-vlasenko 4e12b71
Add the rule to phpcs.xml.dist.
anton-vlasenko e2f7e90
Guard functions and classes.
anton-vlasenko 1cc8f77
Guard functions and classes.
anton-vlasenko 7db4995
Fix CS.
anton-vlasenko 835399b
Guard functions and classes.
anton-vlasenko 0db5b14
Guard functions and classes.
anton-vlasenko a448571
Guard functions and classes.
anton-vlasenko 4c44f1d
Guard functions and classes.
anton-vlasenko 3b3e147
Guard functions and classes.
anton-vlasenko eee0473
Guard functions and classes.
anton-vlasenko f9c8746
Guard functions and classes.
anton-vlasenko 4f50af3
Guard functions and classes.
anton-vlasenko 4681443
Guard functions and classes.
anton-vlasenko 73c6aae
Guard functions and classes.
anton-vlasenko a9d3806
Guard functions and classes.
anton-vlasenko f3da181
Guard functions and classes.
anton-vlasenko 686d3e0
Guard functions and classes.
anton-vlasenko 51e7ebe
Revert code style changes back.
anton-vlasenko ad92156
Fix cs errors.
anton-vlasenko 42ec0e9
Move the package to `test/php`.
anton-vlasenko 27dc135
Don't whitelist "WP.+Gutenberg" classes.
anton-vlasenko a088af5
Update code owners.
anton-vlasenko 4457480
Fix indents.
anton-vlasenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't exist in core, because we patched kses directly. I guess it could be prefixed with
gutenberg
instead and then it wouldn't need thefunction_exists
check? (there may be other functions inlib/
to which the same applies)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tellthemachines Hmm, I'm not as knowledgeable as you in the
lib/compat
stuff.So, I'm asking myself, could renaming
allow_filter_in_styles()
togutenberg_allow_grid_functions_in_styles()
break backward compatibility?Honestly, I would prefer if this is resolved within the scope of another PR, as I'm tryting to keep this PR focused on enforcing CI checks against redeclaraions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been wondering about that too. Imho as a "golden rule of thumb" it would probably be safer to always do function_exists()/class_exists() in the plugin's code, no matter what! Scrapping WP betas because of old versions of Gutenberg having conflicting function/class names is no fun.
So perhaps absolutely all functions and classes in /lib should always be wrapped in a
_exists
, no matter what. This could eventually "teach" some contributors about the relation WP <=> plugin too :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point! I don't think renaming would break back compat because this function only exists in the plugin, and there are no matches other than gutenberg in the wp directory. But yeah, it doesn't really matter and if leaving it as is can have an educational value, I'm happy with that!