FatalErrorException in Inflector.php line 265: syntax error, unexpected ':', expecting ';' or '{'

It's a PHP version issue, update to PHP 7.0 and doctrine/inflector will work properly because doctrine/inflector 1.20 and above require PHP 7.

But if you want to stay at your current PHP version, you can downgrade the doctrine/inflector version by running the following commands:

  1. Delete the composer.lock file

    rm -f Composer.lock

  2. Delete the vendor

    rm -R -f vendor

  3. composer install

  4. Install the doctrine/inflector according to your php version

    composer require doctrine/inflector:1.1.0

doctrine/inflector:1.1.0 supports PHP 5.6 & above. If you have another version of php, you can refer to this link


It's really obvious when you search for this file name and then start comparing package versions.

You are requiring laravelcollective/html at any version, so, for now, the latest version is 5.5.x. This package in its turn requires "doctrine/inflector": "~1.1",, so any version below 2.0, which is currently 1.3.0 and requires PHP 7.0 or higher.

If you look at the source of the latest inflector.php, you will see a return type is set on line 265, which is only supported in PHP 7.0 and up.

You are using PHP 5.6.24, so this code won't work on your system.

The simple way to fix your error is to use the laravelcollective/html version corresponding to your Laravel version. Which should probably be 5.2.*.


I'm working on:

  • Laravel 5.1
  • PHP 5.6.36

My table name is like this: "test_meetings"

I solved the error specifying in testMeeting.php Model the table name:

protected $table = 'test_meetings';

Tags:

Php

Laravel