Skip to content
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

Add PHP-version-specific traits to extend the upgrader skin feedback method #5283

Merged

Conversation

@schlessera
Copy link
Member

schlessera commented Sep 18, 2019

WordPress trunk is doing refactorings to use more PHP 5.6+ features since the minimum PHP version was raised.

As long as we stick to PHP 5.4, we need to provide compatibility mechanisms to deal with this.

This PR adds a Compat namespace to systematically provide compatibility code that can be easily retraced and removed later again.

This should solve the build failure found at https://travis-ci.org/wp-cli/wp-cli/jobs/586215547#L736

Related #5282

…method
@schlessera schlessera requested a review from wp-cli/committers as a code owner Sep 18, 2019
@schlessera schlessera added this to the 2.4.0 milestone Sep 18, 2019
@danielbachhuber danielbachhuber self-requested a review Sep 18, 2019
Copy link
Member

danielbachhuber left a comment

Wow, this is fancy.

@schlessera

This comment has been minimized.

Copy link
Member Author

schlessera commented Sep 18, 2019

Well, it might look over-complicated, but I wanted to:

  • Have the offending signature in two different files (to avoid parse errors);
  • Reuse the autoloader without needing to add additional hacks;
  • Avoid needing to have two complete copies of the extending class just for the signature change;
  • Do all of this in such a way we can easily spot compat code and declutter when we bump the minimum version.
@danielbachhuber

This comment has been minimized.

Copy link
Member

danielbachhuber commented Sep 18, 2019

Well, it might look over-complicated, but I wanted to:

No worries — I think it's a pretty clever solution, just not entirely obvious.

@schlessera schlessera merged commit 9abc7fc into master Sep 18, 2019
2 checks passed
2 checks passed
DEP All dependencies are resolved
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@schlessera schlessera deleted the fix-signature-change-in-upgrader-skin-feedback-method branch Sep 18, 2019
schlessera added a commit to wp-cli/widget-command that referenced this pull request Sep 30, 2019
We need to require latest `dev-master` version of the `wp-cli/wp-cli` framework for now because of wp-cli/wp-cli#5283

This should be reverted again once the above PR is part of a stable release of the framework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.