当我升级Magento 2.4.4时,我将获得弃用的功能:返回composer \ repository \ compositerepository :: count()
当我将Magento 2.4.3升级为2.4.4时,我遇到了php8.1弃用功能错误。
php致命错误:在可数的继承期间:未熟悉的异常:弃用功能:Composer \ Repository \ CompositerePository \ CompositerePository :: Count()应与可计数:: count():int():int():应使用在/var/www/html/vendor/composer/composer/src/composer/repository/repositority/compositerepository.php中暂时抑制通知errirhandler.php:61
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
从PHP 8.1开始,您必须修复函数count()的返回类型。我们需要修改2个文件。
将公共功能计数()更改为公共功能count():int
goto => \ vendor \ composer \ composer \ src \ composer \ repository \ arrayrepository.php(第277列)
goto =>供应商\ composer \ composer \ src \ composer \ copository \ compositerepository.php(第180行)
As of PHP 8.1, you have to fix the return type of the functions count(). We need to modify 2 files.
Change public function count() to public function count(): int
Goto => \vendor\composer\composer\src\Composer\Repository\ArrayRepository.php (line 277)
Goto => vendor\composer\composer\src\Composer\Repository\CompositeRepository.php (line 180)
我以这种方式解决了(作曲家2.3.5):
Composer2要求Magento/Composer-root-Update-Plugin〜2.0 -no-update
copser2 Update>使用“使用”
使用“ require-dev“从Magento 2.4.4 Composer.json
“ require-dev”:{
“诱人的框架/艾尔·帕普尼”:“ 〜1.5.0”,
“ dealerDirect/phpcodesniffer-compososer-installer”:“^0.7.0”,
“ friendsofphp/php-cs-fixer”:“ 〜3.3.0”,
“ lusitanian/oauth”:“ 〜0.8.10”,
“ Magento/Magento编码标准”:“*”,
“ Magento/Magento2功能测试框架”:“^3.7”,
“ pdept/pdepend”:“ 〜2.10.0”,,
“ phpmd/phpmd”:“^2.9.1”,
“ phpstan/phpstan”:“ 〜1.2.0”,,
“ phpunit/phpunit”:“ 〜9.5.0”,,
“塞巴斯蒂安/phpcpd”:“^6.0.3”,
“ Squizlabs/php_codesniffer”:“ 〜3.6.0”,
“ Symfony/Finder”:“^5.2”
}
I solved in this way (by composer 2.3.5):
composer2 require magento/composer-root-update-plugin ~2.0 --no-update
composer2 update
Using the "require-dev" libs taken from Magento 2.4.4 composer.json https://github.com/magento/magento2/blob/2.4.4/composer.json
"require-dev": {
"allure-framework/allure-phpunit": "~1.5.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"friendsofphp/php-cs-fixer": "~3.3.0",
"lusitanian/oauth": "~0.8.10",
"magento/magento-coding-standard": "*",
"magento/magento2-functional-testing-framework": "^3.7",
"pdepend/pdepend": "~2.10.0",
"phpmd/phpmd": "^2.9.1",
"phpstan/phpstan": "~1.2.0",
"phpunit/phpunit": "~9.5.0",
"sebastian/phpcpd": "^6.0.3",
"squizlabs/php_codesniffer": "~3.6.0",
"symfony/finder": "^5.2"
}
只需更新Composer.json带有此包装的JON
,还需要使用最新的作曲家矿山(2.3.10)
just update the composer.json with this packages in require
Also, Use latest composer mine was ( 2.3.10)
不用担心。我面临着Silimar问题,并通过更新作曲家包来解决。
作曲家需要作曲家/作曲家:〜2.2.0 -W
No worries. I was facing silimar issue and fixed by updating the composer package.
composer require composer/composer:~2.2.0 -W
最有可能的问题是,您尚未将所有Dev-Requires更新到2.4.4的最后一次。事实证明,如果没有更新,则这些锁定作曲家/作曲家模块为2.0.x。
The most likely issue is that you haven't updated all your dev-requires to the lastest from 2.4.4. It turns out these lock the composer/composer module to 2.0.x if they aren't updated.
只需将作曲家更新为版本2.3.9-在此版本中,计数方法包含类型
Just update composer to version 2.3.9 - in this version count method contains type