Skip to content

Conversation

schlessera
Copy link
Member

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

Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is fancy.

@schlessera
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
Copy link
Member

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
@schlessera schlessera deleted the fix-signature-change-in-upgrader-skin-feedback-method branch September 18, 2019 14:11
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.
schlessera added a commit to wp-cli/widget-command that referenced this pull request Jan 5, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants