Symfony/composer在php8.2中显示Deprecated错误

qyyhg6bp  于 2023-09-29  发布在  PHP
关注(0)|答案(1)|浏览(543)

我试图为我最近升级的(centos)dev php环境(现在在php 8.2.10上)获取最新版本的mPDF,但我收到以下Symfony错误:

$ composer require mpdf/mpdf

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 /usr/share/php/Symfony3/Component/Console/Helper/HelperSet.php on line 104
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/php/JsonSchema5/Constraints/Constraint.php:48
Deprecation Notice: Return type of Symfony\Component\Process\Process::getIterator($flags = 0) should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony3/Component/Process/Process.php:567
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 /usr/share/php/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 /usr/share/php/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 /usr/share/php/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:799
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:804
Do not run Composer as root/super user! See https://getcomposer.org/root for details

我该怎么办?
(PS.我不是这里的系统管理员Maven……我开发得很好,但我管理得不好。任何帮助将不胜感激)

编辑#1 -新增版本信息:

$ composer --version

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 /usr/share/php/Symfony3/Component/Console/Helper/HelperSet.php on line 104
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/php/JsonSchema5/Constraints/Constraint.php:48
Deprecation Notice: Return type of Symfony\Component\Process\Process::getIterator($flags = 0) should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony3/Component/Process/Process.php:567
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 /usr/share/php/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 /usr/share/php/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 /usr/share/php/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:799
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:804
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]?
Composer 2.1.3 2021-06-09 16:31:20
szqfcxe2

szqfcxe21#

好的-在Nico的帮助下,我更新了composer,然后更新了mPDF

$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php
$ mv composer.phar /usr/bin/composer
$ composer --version

$ composer require mpdf/mpdf

相关问题