Problem/Motivation

When PHP version is below recommend 8.1 Upgrade Statues recommends the following:

PHP version should be at least 8.1.0. Before updating to PHP 8, use $ composer why-not php:8.1 to check if any projects need updating for compatibility. Also check custom projects manually.

However the command composer why-not php:8.1 triggers the following error:

➜  site git:(master) ✗ composer why-not php:8.1


  [Symfony\Component\Console\Exception\RuntimeException]
  Not enough arguments (missing: "version").


prohibits [-r|--recursive] [-t|--tree] [--] <package> <version>

Steps to reproduce

Attempt to run the command composer why-not php:8.1.

Proposed resolution

Update messaging to recommend the correctly formatted command: composer why-not php 8.1

CommentFileSizeAuthor
#5 Screenshot 2022-08-15 at 8.54.06.png100.93 KBGábor Hojtsy
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wells created an issue. See original summary.

wells’s picture

Status: Active » Needs review
wells’s picture

Title: Recommend composer command for PHP compatibility check fails » Recommended composer command for PHP compatibility check fails
Gábor Hojtsy’s picture

Issue summary: View changes
FileSize
100.93 KB

Interesting. I did not try it when I updated from why-not php:8 to why-not php:8.1, but the php:8 syntax is documented in the official docs at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-

wells’s picture

Interesting. Opened a PR to update the docs: https://github.com/composer/composer/pull/10994

wells’s picture

That PR was merged so the composer documentation is corrected now.

xaa’s picture

Status: Needs review » Reviewed & tested by the community

  • 85eacf4 committed on 8.x-3.x
    Issue #3303527 by wells, Gábor Hojtsy, xaa: Recommended composer command...
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Looks great, thanks! Also special thanks for getting the composer docs themselves fixed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.