Laravel 5 : Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)
You need to install PHP version 7.1 because nullable types were introduced in 7.1:
?string $value
And from the Laravel docs:
You will need to make sure your server meets the following requirements:
PHP >= 7.1.3
For php7.0 only
If your server doesn't have php 7.1 and above and you are only restricted to use php7.0 do as below:
- Delete vendor folder
- Delete composer.lock file
Add this to composer.json file under
config
"platform": { "php": "7.0.0"}
As well, ensure PHP version under require
is set to 7.0.0 as shown below in config.platform.php
:
"config": { "platform": { "php": "7.0.0" } }
- Run composer install using CMD
This now will make sure that only dependencies compatible with php7.0 are installed.