MAC update and use composer

Recently, a new project needs to be built, and it is found that the composer installation project has an error message

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/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/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112

Preliminary investigation, the composer library is not new

 After translation, it turns out that the version has not been updated for a long time, and some methods of Composer version 2.0.13 are deprecated

View the current composer version and basic information

composer -V

 

composer

After confirming the current version, you can upgrade to the next version to see the result

composer selfupdate

It prompts that the upgrade is successful. If you want to go back, execute it to return to the previous version ( if the upgrade is successful, do not operate )

composer self-update --rollback

Finally, look at the upgraded version 

composer -V

 

The error is solved, and you can play with composer again 

Guess you like

Origin blog.csdn.net/qq_33665793/article/details/129762665