Skip to content

[5.4] syntax error, unexpected ':', expecting ';' or '{' #22828

@andrey-helldar

Description

@andrey-helldar
  • Laravel Version: 5.4.36
  • PHP Version: 5.6.32 (Homestead)

Description:

The project works under PHP5.6. After updating the dependencies, an error occurred:
2018-01-17 09-36-05 whoops there was an error - google chrome

Steps To Reproduce:

The error occurs if I access the apiResource method in api.php:

app('router')
    ->apiResource('orders', 'Api\OrdersController', [
        'only' => ['show', 'store'],
    ]);

If you remove the use of this method, the error disappears.

Next, in the file composer.lock found the following dependencies:

"name": "doctrine/annotations",
"version": "v1.6.0",
"php": "^7.1"

"name": "doctrine/collections",
"version": "v1.5.0",
"php": "^7.1"

"name": "doctrine/inflector",
"version": "v1.3.0",
"php": "^7.1"

"name": "doctrine/instantiator",
"version": "1.1.0",
"php": "^7.1"

"name": "symfony/css-selector",
"version": "v4.0.3",
"php": "^7.1.3"

"name": "symfony/event-dispatcher",
"version": "v4.0.3",
"php": "^7.1.3"

"name": "symfony/yaml",
"version": "v4.0.3",
"php": "^7.1.3"

"name": "phpdocumentor/reflection-docblock",
"version": "4.2.0",
"php": "^7.0",

"name": "phpunit/php-token-stream",
"version": "2.0.2",
"php": "^7.0"

If I use routes:

app('router')
    ->get('orders/{orders}', 'Api\OrdersController@show')
    ->name('orders::show');

app('router')->post('orders', 'Api\OrdersController@store')
    ->name('orders::store');

then problem not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions