composer 和 laravel 7 无法使用 php 8.1

composer and laravel 7 not working with php 8.1

今天我将 xampp 中的 php 更新为 8.1.0,之后所有 Laravel 项目都在本地主机中停止。

因此,更新后 composer.json 从

"php": "^7.3|^8.0",

我看到作曲家在 运行 作曲家更新或任何作曲家命令后遇到这样的问题:

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://C:/ProgramData/ComposerSetup/bin/composer.phar/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://C:/ProgramData/ComposerSetup/bin/composer.phar/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://C:/ProgramData/ComposerSetup/bin/composer.phar/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://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:277
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://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:277
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://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48

如何解决这个问题,因为作曲家有错误,我的所有项目都停止了。

我在最新的 xampp 上遇到了同样的问题,我所做的只是回到 7.4.26,现在 6-7 的安装工作正常。