laravel-5composer-phpphp-parse-error

Cannot use 'PhpParser\Node\Scalar\String' as class name as it is reserved


When I use the composer to install Laravel 5 I get this error:

Cannot use 'PhpParser\Node\Scalar\String' as class name as it is reserved in /Applications/XAMPP/xamppfiles/htdocs/learnlaravel5/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php on line 86

Image of the error here

What is wrong?


Solution

  • I assume you are using PHP7 as you wouldn't get this error otherwise (?).

    In PHP7 String is now a reserved keyword along with some others. The PHP-Parser library used this keyword but was since fixed in April 2015. Try upgrading the PHP-Parser library, this should help.