-
Notifications
You must be signed in to change notification settings - Fork 107
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
Use static closures for minor performance improvement whenever instance access is not needed #729
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0bab7d6
Add SlevomatCodingStandard.Functions.StaticClosure sniff
westonruter 7418bf6
Run phpcbf
westonruter 2c65a34
Run composer update
westonruter f8b62ef
Apply StaticClosure sniff to tests as well
westonruter 81a77e9
Reuse __return_null
westonruter 816040b
Use __return_null in two additional cases
westonruter 55e938c
Merge branch 'trunk' of https://github.com/WordPress/performance into…
westonruter 6e8833b
Add missing static keywords to new closures
westonruter 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
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 coding standard requires php 7.2. Will would make this plugin break in 7.2- no.
https://github.com/slevomat/coding-standard/blob/f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7/composer.json#L19
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.
It would not break the plugin, because the composer autoloader is only used in tests.
It would just break tests running on PHP 5.6. However, right now tests are not running on this version on CI, so... 🤷
Edit: looks like there is #399 for updating tests.
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.
Please continue discussion at #730 (comment)
As I understand, there are three possible ways to about this:
composer require
this package before doingcomposer install
before running PHPCScomposer remove
this package before doingcomposer install
prior to running PHPUnit in PHP<7.2.I think the third option is ideal, since all normal development environments would be running PHP 7.2+. It's only the exception case, specifically on GHA, where PHP 5.6 is needed. This would allow a developer to have all packages installed normally.
The first option doesn't seem ideal since there would be a separate composer file to maintain, and Dependabot wouldn't automatically be aware of it.
This comment was marked as duplicate.
Sorry, something went wrong.
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.
We may not want this sniff after all. See WordPress/wordpress-develop#4457 (comment)
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.
Noting that we could still make a separate decision from core here, there are several plugins that have stricter requirements than core to enforce better coding practices. I don't feel strongly about this one, but I feel like if we can find a way that we can integrate it that remains compatible with PHP 5.6, I'd be happy to include it.
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.
I am not against using this rule set, but php 5.6 compat is the key here.
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.
Can the 5.6 compat be handled as part of #399? Without CI actually running anything in 5.6, it makes it a bit difficult to verify the compat is working, or at least it seems a bit premature.