Jiizen
Jiizen

Reputation: 129

Symfony 4 - Default value for parameters with a class type hint can only be NULL

I have a similar problem than here : Symfony 4 : Default value for parameters with a class type can only be but when I launch composer commands... :

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...

I don't understand because I use the 7.1.8 PHP version... I installed the whole project with my PHP 7.1.8... :/

Code affected :

/**
     * @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';
    }

An idea for me ?

Thank you very much !

Upvotes: 1

Views: 3796

Answers (1)

Jiizen
Jiizen

Reputation: 129

I don't know if it's OK to do that... I replaced this line in composer.json :

 "security-checker security:check": "script"

by :

 "security:check": "symfony-cmd"

I guess and hope the command is the same. I don't understand why. I follow the official documentation of Symfony 4 and I have the correct PHP version. :/

I don't know at all... TT__TT

Upvotes: 1

Related Questions