ItsRD's avatar
Level 4

Lumen fresh install syntax error, unexpected '?'

I installed the latest version of Laravel Lumen running on Laravel Valet. Also checked for the latest php version with php -v.

After following https://lumen.laravel.com/docs/5.6#installing-lumen I get the following error.

Parse error: syntax error, unexpected '?' in /lumenproject/vendor/symfony/http-foundation/Response.php on line 499

Fatal error: Exception thrown without a stack frame in Unknown on line 0

I checked the Response.php file in one of the older releases and I noticed the following which is breaking the project.

Version 3.4 https://github.com/symfony/http-foundation/blob/3.4/Response.php#L480

/**

  • Retrieves the response charset.
  • @return string Character set
  • @final since version 3.2 */ public function getCharset() { return $this->charset; }

Version 4.0+ https://github.com/symfony/http-foundation/blob/4.0/Response.php#L491

/**

  • Retrieves the response charset.
  • @final */ public function getCharset(): ?string { return $this->charset; }

According to the php -v I'm using PHP 7.2.5 (cli) and also did removed all the references to PHP 5.6.

0 likes
1 reply
ItsRD's avatar
Level 4

Solved it by removing all the php versions removing the old php configs, restart valet and reboot pc

Please or to participate in this conversation.