Search code examples
phpyii2composer-phpyii2-advanced-app

yii2 project running errors


I am installed yii2 advanced template using composer all are working fine. System have php7.1.5. Whenever i copy advanced folder in another system it throw syntax error in TestCase.php like below

Parse error: syntax error, unexpected '?' in \advanced\vendor\phpunit\phpunit\src\Framework\TestCase.php on line 822

line 822 is $configurationFilePath = $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] ?? '';

That another system have php5.6.8 So, i am directly install yii2 advanced in that system and it is working fine. I am check TestCase.php the file have lot of differences and the particular line also changed like below

$configurationFilePath = (isset($GLOBALS['__PHPUNIT_CONFIGURATION_FILE']) ? $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] : '');

So i want to know what is going here.My question is not clear please let me know.Thanks in advance


Solution

  • PHP operator ?? is available since PHP7, so u can't expect, that code from PHP7 will work on server with PHP5.

    PHP 7 - Null coalescing operator