最近有新项目需要搭建,发现composer安装项目有报错信息
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 112Deprecated: 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
初步排查,composer库不是新的了
经过翻译,果然是版本长时间没更新,Composer version 2.0.13 有些方法弃用了
查看当前composer版本和基本信息
composer -V
composer
确定了当前版本,就可以升级下版本看结果了
composer selfupdate
提示升级成功,如果想回退的话执行 就能回到上个版本(升级成功的话,切勿操作)
composer self-update --rollback
最后看下升级完成后的版本
composer -V
错误解决,又可以和composer一起玩耍了
来源地址:https://blog.csdn.net/qq_33665793/article/details/129762665