Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FatalErrorException in RouteServiceProvider.php line 7 #22

Closed
simondahla opened this issue Mar 18, 2017 · 7 comments
Closed

FatalErrorException in RouteServiceProvider.php line 7 #22

simondahla opened this issue Mar 18, 2017 · 7 comments

Comments

@simondahla
Copy link

simondahla commented Mar 18, 2017

Getting this error message when trying to run the application:

FatalErrorException in RouteServiceProvider.php line 7:
syntax error, unexpected '{', expecting identifier (T_STRING)

The line it's referring to is: use App\Models\{User, Space, Wiki, Team, Page, Role};

@ziishaned
Copy link
Owner

ziishaned commented Mar 19, 2017

@simondahla what is the php version do you have? This application does't work until you have the version of php 7.0 or after release.

@simondahla
Copy link
Author

simondahla commented Mar 19, 2017

@ZeeSHANU

vagrant@scotchbox:/var/www/opus.local$ php -v
PHP 7.0.17-2+deb.sury.org~trusty+1 (cli) (built: Mar 15 2017 09:38:47) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.17-2+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies

I tried to rewrite that line to

use App\Models\User;
use App\Models\Space;
use App\Models\Wiki;
use App\Models\Team;
use App\Models\Page;
use App\Models\Role;

It seems to fix the problem, but the that kind of error is then found in Wiki.php and probably all other files with that syntax...

@simondahla simondahla reopened this Mar 19, 2017
@simondahla
Copy link
Author

simondahla commented Mar 19, 2017

Also tried to upgrade to PHP 7.1 but without success.

vagrant@scotchbox:/var/www/opus.local$ php -v
PHP 7.1.3-2+deb.sury.org~trusty+1 (cli) (built: Mar 15 2017 09:53:03) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.3-2+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies

@ziishaned
Copy link
Owner

ziishaned commented Mar 19, 2017

@simondahla This is strange because I have PHP 7.0.9 and everything is working fine. As you can see in PHP documentation we can group use statements like this:

// PHP 7+ code
use some\namespace\{ClassA, ClassB, ClassC as C};
use function some\namespace\{fn_a, fn_b, fn_c};
use const some\namespace\{ConstA, ConstB, ConstC};

@sandeepscet
Copy link

Solved after PHP 7 installation.

@simondahla
Copy link
Author

simondahla commented Mar 21, 2017

@ZeeSHANU I hear you. As you can see I'm using PHP 7.1.3 and it's still not working.

Any other suggestions on how to solve this?

@ziishaned
Copy link
Owner

@simondahla To solve your issue just explode the grouped use statements like this

use {ClassA, ClassB};

with

use ClassA;
use ClassB;

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants