Yii2 Advanced ( syntax error, unexpected '?' )

I installed Yii2 Advanced on my localhost, but when I try to reset my password I get this error :




PHP Parse Error – yii\base\ErrorException

syntax error, unexpected '?'


in I:\zzerver\Uwamp -port 84\uw-cms-p8585\www\yii65a\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMessage.php at line 496




				*

     * @return int

     */

    public function getPriority()

    {

        list($priority) = sscanf($this->getHeaderFieldModel('X-Priority'),

            '%[1-5]'

            );

 

        return $priority ?? 3;

    }



I’m using php-5.6.18


return $priority ?? 3;

Your return is using a null coalesce operator, wich only works in PHP >=7.

To solve this with php5.6 you should change to :




return isset($priority) ? $priority : 3;



Thank you so much it’s worked but there other files I have to change ; so I try to rebuild my web on php7 because a lot of files are made for php7; I get so many errors and every time I have to change an other file.

Thank you so much again.