Skip to content

Conversation

@stefanfisk
Copy link

The latest version of composer/composer uses type declarations, which is not backwards compatible with PHP 5.6.

See wp-cli/package-command#172

@stefanfisk stefanfisk requested a review from a team as a code owner April 3, 2023 08:08
@stefanfisk
Copy link
Author

I don't understand what is generating https://github.com/wp-cli/wp-cli/pull/5757/files#annotation_10225078703.

@stefanfisk
Copy link
Author

This change requires composer/composer: ^1.10.23 || ^2.5, so that PHP 7.4+ gets the base class with types.

I wasn't at all sure about how you handle dep versions for this project. The only code that uses this class in is the package-command repo, but the dep is defined in both that repo and wp-cli-bundle.

@danielbachhuber
Copy link
Member

I don't understand what is generating https://github.com/wp-cli/wp-cli/pull/5757/files#annotation_10225078703.

Hm, I'm not sure either. @schlessera Any ideas?

@danielbachhuber
Copy link
Member

This change requires composer/composer: ^1.10.23 || ^2.5, so that PHP 7.4+ gets the base class with types.

I wasn't at all sure about how you handle dep versions for this project. The only code that uses this class in is the package-command repo, but the dep is defined in both that repo and wp-cli-bundle.

Can you try adding the branch for wp-cli/package-command#173 as a dependency and we can see if that gets tests passing?

@stefanfisk
Copy link
Author

stefanfisk commented Apr 5, 2023

@danielbachhuber The tests pass when I run them locally in wp-cli-dev with updated deps for wp-cli-bundle and package-command. I'm not sure that I understand what you are proposing, do you mean like this f70d0a8?

@danielbachhuber
Copy link
Member

I'm not sure that I understand what you are proposing, do you mean like this f70d0a8?

@stefanfisk That's what I was thinking, but now it seems the tests fail in some other spectacular way.

This change requires composer/composer: ^1.10.23 || ^2.5, so that PHP 7.4+ gets the base class with types.

Should/could this be composer/composer: ^1.10.23 || ^2.2 || ^2.5?

@stefanfisk
Copy link
Author

 @danielbachhuber I think that was caused by how I was defining the repository in composer.json. Try running the tests again now.

@danielbachhuber
Copy link
Member

@stefanfisk Huh! The code quality tests are passing now! Some of the functional tests are passing, and others are failing.

@danielbachhuber
Copy link
Member

@schlessera might have helpful feedback when he's able to chime in.

@stefanfisk
Copy link
Author

Is there any way that I can run the test matrix locally?

When I have the time I’ll try checking the composer version instead of the PHP version.

@wojsmol
Copy link
Contributor

wojsmol commented Apr 14, 2023

@stefanfisk Simplest way is to create PR to you fork of this repository and then there is no first time contributor limit.

@stefanfisk
Copy link
Author

Alright, I think I understand better now, but something's still off.

The Dependabot branch breaks on PHP < 7.4, because composer v1 is not compatible with the test suite (allow-plugins isn't supported), and composer v2.3+ requires php:^7.2.5. So the version for composer/composer should be ^1.10.23 || ~2.2.17 || ^2.5.5. In addition to changing the PHP requirement, composer v2.3 also contained breaking changes for ComposerIO and some other classes, which is why Dependabot gets it wrong. I've got a PR which depends on a forked package-command with that version spec here https://github.com/stefanfisk/wp-cli/pull/2.

The only failing functional tests is now the one below, and I don't see how it could be related to this PR.

--- Failed steps:

001 Scenario: Run cache flush on ms_site_not_found  # features/bootstrap.feature:389
      When I run `wp cache flush --url=invalid.com` # features/bootstrap.feature:404
        $ wp cache flush --url=invalid.com
        Success: The cache was flushed.
        
        Warning: Ignoring the --url=<url> argument because flushing the cache affects all sites on a multisite installation.
        cwd: /tmp/wp-cli-test-run--643a47aba16186.60100901/
        run time: 0.1529080867[76](https://github.com/stefanfisk/wp-cli/actions/runs/4706473897/jobs/8347897222?pr=2#step:13:77)73
        exit status: 0 (RuntimeException)

Something is however wrong with the unit tests for PHP 5.6-7.1, as they fail to install composer https://github.com/stefanfisk/wp-cli/actions/runs/4706473897/jobs/8347986152#step:4:17.

@danielbachhuber
Copy link
Member

@stefanfisk Are you able to attend Hack Day this coming Friday, November 10th? I think there will be some folks around in the Slack channel who can help you sort this out.

The latest version of `composer/composer` uses type declarations, which
is not backwards compatible with PHP 5.6.

See wp-cli/package-command#172
@schlessera
Copy link
Member

@stefanfisk I've been looking more closely at this to finally get this fixed.

As it turns out, the ComposerIO file in the wp-cli/wp-cli is a left-over from when we split up into separate packages. The framework actually never uses it, the wp-cli/package-command repository is the only one where it is needed. So the fix should be to remove it here and add compatibility solely to the wp-cli/package-command.

Also, these manual includes really mess with static analysis, linters and autoloaders. The approach for having a clean compat setup should mirror what we already have in https://github.com/wp-cli/wp-cli/tree/main/php/WP_CLI/Compat.

I'll create a fresh PR in the wp-cli/package-command repository. I'm closing this one as it cannot be properly applied.

Thanks for all of your work already on this, and sorry I didn't get to look into it earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants