【发布时间】:2018-05-10 10:20:30
【问题描述】:
我有一个与这里类似的问题:Symfony 4 : Default value for parameters with a class type can only be 但是当我启动作曲家命令时...:
executing script security-checker security:check [KO]
[KO]
Script security-checker security:check returned with error code 255
!! PHP Fatal error: Default value for parameters with a class type hint can only be NULL in /xxx/vendor/symfony/console/Application.php on line 83
!!
Script @auto-scripts was called via post-update-cmd
When I launched for example : php7 composer.phar update, because I had the same problem for others commands...
我不明白,因为我使用的是 7.1.8 PHP 版本...我用我的 PHP 7.1.8 安装了整个项目...:/
受影响的代码:
/**
* @param string $name The name of the application
* @param string $version The version of the application
*/
public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN') // Line affected HERE (line 83)
{
$this->name = $name;
$this->version = $version;
$this->terminal = new Terminal();
$this->defaultCommand = 'list';
}
对我有什么想法?
非常感谢!
【问题讨论】:
-
能否发布受影响的代码?
-
没关系。受影响的行是(函数的)第一行。感谢您的帮助。
-
你确定你在 PHP 7 上运行吗? Composer 可能使用与您的网络服务器不同的 PHP 版本。在命令行上运行
php -v会得到什么? -
我有一个别名 php7。当我运行我的别名“php7 -v”时,我得到这个: PHP 7.1.8 (cli) (built: Aug 17 2017 11:34:56) (NTS) Copyright (c) 1997-2017 The PHP Group Zend Engine v3 .1.0,版权所有 (c) 1998-2017 Zend Technologies
-
哈,它也更改为 7.1.8... 但通常情况下,我想要带有 php 命令的 PHP 5.6。我在 Mamp 中暂时更改了此设置,以确保 CLI 也有 7.1.8 版本。
标签: php composer-php symfony4