Laravel 9 - laravel new 命令有错误:已弃用:返回 Symfony\Component\Process\Process::getIterator 类型(int $flags = 0)

Sya*_*ien 12 php laravel composer-php

我想第一次尝试安装 Laravel 9...所以,我将 PHP 更新到最新的(版本 8.1.2)并将 Composer 更新到最新的(版本 2.2.6)...

当我调用laravel new my-project命令时,它显示错误

Deprecated: Return type of Symfony\Component\Process\Process::getIterator(int $flags = 0) should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\Users\LAPTOP-SYAMSOUL\AppData\Roaming\Composer\vendor\symfony\process\Process.php on line 620

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 C:\Users\LAPTOP-SYAMSOUL\AppData\Roaming\Composer\vendor\symfony\console\Helper\HelperSet.php on line 94
Run Code Online (Sandbox Code Playgroud)

如何解决这个错误?

Nic*_*ase 23

听起来您应该运行composer global update来更新已全局安装的软件包。


小智 21

作曲家需要更新

composer self-update
composer global update
Run Code Online (Sandbox Code Playgroud)