symfony-cli / symfony-cli

The Symfony CLI tool
https://symfony.com/download
GNU Affero General Public License v3.0
520 stars 103 forks source link

Should check:requirements also check for an outdated composer? #190

Open mikevrind opened 2 years ago

mikevrind commented 2 years ago

I was running into a few issues this evening while trying to install a new project following the setup guide.

The command symfony new my_project_directory --version="6.1.*" --webapp produced the following output:

$ symfony new my_project_directory --version="6.1.*" --webapp
* Creating a new Symfony 6.1.* project with Composer
  (running /usr/local/bin/composer create-project symfony/skeleton /Users/mikevrind/code/mikevrind/my_project_directory 6.1.* --no-interaction)

* Setting up the project under Git version control
  (running git init /Users/mikevrind/code/mikevrind/my_project_directory)

  (running /usr/local/bin/composer require webapp --no-interaction)

PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\CompositeRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/src/Composer/Repository/CompositeRepository.php:180
Info from https://repo.packagist.org: #StandWithUkraine

  [InvalidArgumentException]
  Could not find package webapp.

  Did you mean one of these?
      peej/tonic
      leafs/leaf
      symfony/webapp-meta
      symfony/webapp-pack
      hiqdev/hidev-webapp

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...

  unable to run /usr/local/bin/composer require webapp --no-interaction

First I didn't really understood the problem since I was using a recent Symfony CLI (5.4.14) and a recent PHP version (8.1.11). Then I noticed the errors where not Symfony related but related to Composer. I was using Composer 2.1.3 (2021-06-09). Updating composer fixed all my issues.

That got me thinking, should (or could) the command symfony check:requirements also check for an outdated Composer version? It would have certainly helped my in this situation. I'm always using Composer within Docker containers so I wasn't aware of my outdated version.

tucksaun commented 2 years ago

Could be a nice improvement 👍