I try to run Yii2 app on apache server with 7.0 php version. Yii2 framework package version:
yiisoft/yii2 3.0.x-dev 9f215f3
So, when I run my site.loc index page in the browser, I get an error
Parse error: syntax error, unexpected '=' in /var/www/html/remi-web.co/vendor/yiisoft/yii2/di/Container.php on line 365
The piece of code which cause an error:
/* @var $reflection ReflectionClass */
[$reflection, $dependencies] = $this->getDependencies($class);
An array[] in the left side of equing statement. I have been never faced with this kind of statement before, so I don't even know where to look for explaining.
I have just install php7.0 on Apache so maybe it needs some module installed or some property enable in settings to run it properly.
There is part of phpinfo details:
PHP Version 7.0.33-23+ubuntu18.04.1+deb.sury.org+1
Loaded Modules core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_php7 mod_reqtimeout mod_rewrite mod_setenvif mod_status
It works on production server with PHP Version 7.0.32, but doesn't work on my local machine.
Since PHP 7.1 we have destructuring assigment of arrays.
This is shorthand for
list():You can read about that PHP 7.1 feature here.