Skip to content

Add compatibility with composer v2.4+#6503

Merged
jeffwidman merged 1 commit intodependabot:mainfrom
stefangr:add-compatibility-with-composer-v2.4-v2.5
Jan 23, 2023
Merged

Add compatibility with composer v2.4+#6503
jeffwidman merged 1 commit intodependabot:mainfrom
stefangr:add-compatibility-with-composer-v2.4-v2.5

Conversation

@stefangr
Copy link
Copy Markdown
Contributor

When running the dependabot-script with DEBUG_HELPERS=true I saw this error:

PHP Deprecated:  Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead. in /opt/composer/v2/vendor/composer/composer/src/Composer/Installer.php on line 1289

In this PR I work around the deprecations (there was one more, which was not verbose) and also added a forward compatible change to disable the audit.

Applied changes:

@stefangr stefangr requested a review from a team as a code owner January 23, 2023 21:20
Copy link
Copy Markdown
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Oh perfect timing, I was planning to work on #5720 / #6385 / #6385 (comment) later this week!

I suspect life is simpler if we just keep on the latest composer and don't worry about backwards compatibility for options... I assume most folks run dependabot within the context of our bundled dependabot-core image, so they'll be using whatever version of composer is bundled with that. If you think differently for some reason, please let me know.

For simplicity of working across timezones / PR rebases, does the following sound reasonable?

  1. Merge this
  2. Rebase the Dependabot PR to bump composer to 2.5.x
  3. Add a commit remove the optional checks, such that setAudit is always called.
  4. Merge... so hopefully we'll be back up to composer latest by EOD 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😍 for fixing this, as a non-PHP expert, I would have muddled for a while before realizing it needed another import...

- Use `eventDispatcher::setRunScripts` instead of deprecated `Installer::setRunScripts`
- Use `Installer::setPlatformRequirementFilter` instead of deprecated `Installer::setIgnorePlatformRequirements`
- Use `setAudit(false)` if Installer has that method
@jeffwidman jeffwidman force-pushed the add-compatibility-with-composer-v2.4-v2.5 branch from 83376ae to 5b89b08 Compare January 23, 2023 22:02
@jeffwidman jeffwidman enabled auto-merge (squash) January 23, 2023 22:03
@jeffwidman jeffwidman disabled auto-merge January 23, 2023 22:04
@jeffwidman jeffwidman enabled auto-merge (squash) January 23, 2023 22:06
@jeffwidman jeffwidman merged commit b6bc363 into dependabot:main Jan 23, 2023
@stefangr
Copy link
Copy Markdown
Contributor Author

For simplicity of working across timezones / PR rebases, does the following sound reasonable?

1. Merge this

2. Rebase the Dependabot PR to bump `composer` to `2.5.x`

3. Add a commit remove the optional checks, such that `setAudit` is always called.

4. Merge... so hopefully we'll be back up to `composer` `latest` by EOD +1

That sounds completely reasonable. 👍

@stefangr stefangr deleted the add-compatibility-with-composer-v2.4-v2.5 branch January 24, 2023 07:38
alcere pushed a commit that referenced this pull request Feb 20, 2023
When running the dependabot-script with `DEBUG_HELPERS=true` I saw this error:
```
PHP Deprecated:  Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead. in /opt/composer/v2/vendor/composer/composer/src/Composer/Installer.php on line 1289
```

So this commit resolves the deprecations and also added a forward compatible change to [disable the audit](#6385 (comment)).

Applied changes:
- Use `eventDispatcher::setRunScripts` instead of [deprecated `Installer::setRunScripts`](https://github.com/composer/composer/blob/2.5.1/src/Composer/Installer.php#L1241)
- Use `Installer::setPlatformRequirementFilter` instead of [deprecated `Installer::setIgnorePlatformRequirements`](https://github.com/composer/composer/blob/2.5.1/src/Composer/Installer.php#L1297)
- Use `setAudit(false)` if Installer has that method

Co-authored-by: Stefan Grootscholten <stefan.grootscholten@tripolis.com>
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.

2 participants