Laravel-ide-helper: Does not work with laravel 5.7?

Created on 18 Sep 2018  Â·  17Comments  Â·  Source: barryvdh/laravel-ide-helper

Most helpful comment

Quick fix for this is to comment out all the @method static \Illuminate\Routing\Route blocks in _ide_helper.php, assume it'll be the same for other issues (this would make auto-complete on controller methods in your routes work again)

Not ideal though as you'll have to do it everytime if you have the post-update commands in composer.

All 17 comments

Quick fix for this is to comment out all the @method static \Illuminate\Routing\Route blocks in _ide_helper.php, assume it'll be the same for other issues (this would make auto-complete on controller methods in your routes work again)

Not ideal though as you'll have to do it everytime if you have the post-update commands in composer.

677 is relevant here.

Quick fix for this is to comment out all the @method static \Illuminate\Routing\Route blocks in _ide_helper.php, assume it'll be the same for other issues (this would make auto-complete on controller methods in your routes work again)

Not ideal though as you'll have to do it everytime if you have the post-update commands in composer.

This doesn't help.

Is there some other solution to this?

@xlstefan, suggested fix works: open _ide_helper.php and comment all the @method referring to the static \Illuminate\Support\Facades\Route facade, as following

    /**
     *
     *
//     * @method static \Illuminate\Support\Facades\Route get(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route post(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route put(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route delete(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route patch(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route options(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route any(string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route match(array|string $methods, string $uri, \Closure|array|string|null $action = null)
//     * @method static \Illuminate\Support\Facades\Route prefix(string  $prefix)
     * @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = [])
     * @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = [])
//     * @method static \Illuminate\Support\Facades\Route middleware(array|string|null $middleware)
//     * @method static \Illuminate\Support\Facades\Route substituteBindings(\Illuminate\Support\Facades\Route $route)
     * @method static void substituteImplicitBindings(\Illuminate\Support\Facades\Route $route)
//     * @method static \Illuminate\Support\Facades\Route as(string $value)
//     * @method static \Illuminate\Support\Facades\Route domain(string $value)
//     * @method static \Illuminate\Support\Facades\Route name(string $value)
//     * @method static \Illuminate\Support\Facades\Route namespace(string $value)
//     * @method static \Illuminate\Support\Facades\Route where(array|string $name, string $expression = null)
     * @method static \Illuminate\Routing\Router group(\Closure|string|array $value, \Closure|string $routes)
//     * @method static \Illuminate\Support\Facades\Route redirect(string $uri, string $destination, int $status = 301)
//     * @method static \Illuminate\Support\Facades\Route view(string $uri, string $view, array $data = [])
     * @see \Illuminate\Routing\Router
     */

This just solved issue with: Navigating from route to controller not working but not ~300 other errors.

Most of them are: "Method with the same name already defined in this class".
Functions with names: user, id, once, onceUsingId, validate...

After change _ide_helper.php

class Route extends \Illuminate\Support\Facades\Route {}

to

class Route extends Illuminate\Support\Facades\Route {}

Just remove the slash \, and restart phpStorm , it works for me .

But I don't understand why.

@wensonsmith it works for me and it not needs to restart phpstorm(2019.1.2) for me .

about "But I don't understand why." :
The reason is because the namespace was introduced incorrectly, so you can't find the namespace, you can't reflect

@wensonsmith

This doesn't work well after the upgrade

Laravel Framework 5.5.45

"barryvdh/laravel-ide-helper": "^2.4",

PHP 7.2.13 (cli) (built: Dec 7 2018 10:41:23) ( NTS )
PhpStorm 2019.1.2
Build #PS-191.7141.52, built on May 8, 2019
JRE: 1.8.0_202-release-1483-b49 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4

the same issue is still in effect

Same here
PhpStorm 2019.2

@wensonsmith

This doesn't work well after the upgrade

Laravel Framework 5.5.45

"barryvdh/laravel-ide-helper": "^2.4",

PHP 7.2.13 (cli) (built: Dec 7 2018 10:41:23) ( NTS )
PhpStorm 2019.1.2
Build #PS-191.7141.52, built on May 8, 2019
JRE: 1.8.0_202-release-1483-b49 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4

Use 2.6.2
So change this line:
> "barryvdh/laravel-ide-helper": "^2.4",

To: > "barryvdh/laravel-ide-helper": "^2.6",

@rahacker2006 this is probably solution for your problem too.
Please check version which you are using. :)

@wensonsmith
This doesn't work well after the upgrade
Laravel Framework 5.5.45
"barryvdh/laravel-ide-helper": "^2.4",
PHP 7.2.13 (cli) (built: Dec 7 2018 10:41:23) ( NTS )
PhpStorm 2019.1.2
Build #PS-191.7141.52, built on May 8, 2019
JRE: 1.8.0_202-release-1483-b49 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4

Use 2.6.2
So change this line:
> "barryvdh/laravel-ide-helper": "^2.4",

To: > "barryvdh/laravel-ide-helper": "^2.6",

@rahacker2006 this is probably solution for your problem too.
Please check version which you are using. :)

I have this version: "barryvdh/laravel-ide-helper": "^2.6", same issue

@rahacker2006 Updated version "barryvdh/laravel-ide-helper": "^2.6" worked for me on PhpStorm 2019.1.2 macOS after a restarting PhpStorm.

@arianacosta I have "barryvdh/laravel-ide-helper": "^2.6", but my version of PhpStorm is 2019.2.

I forgot that the version of Laravel is 5.8, sorry, my bad :(

So change this line:
"barryvdh/laravel-ide-helper": "^2.4",
To "barryvdh/laravel-ide-helper": "^2.6",

This won't make any difference. The caret here means >=2.4 < 3.0.0 so it will install 2.6 anyway with that setting. Only with pre-1.0 versions does the ^ keep the restraint 'safer'.

Any fix for this issue it's still not working in my PHPStorm 2020 also with any laravel version above 5.5 it seems to be broken have tried above fix but it only solves the problem of jumping from route to the controller but no auto-suggestion for controller methods pops up in web.php while defining routes

The original issue about 5.7 isn't relevant anymore, this is an unsupported version of Laravel and we dropped support for them.

As for others having problems: please search existing issues or create new ones for each dedicated problem you encounter

@barryvdh originally an unsupported version, I vote for closing this :}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kickthemooon picture kickthemooon  Â·  3Comments

Gummibeer picture Gummibeer  Â·  3Comments

celorodovalho picture celorodovalho  Â·  4Comments

ivansammartino picture ivansammartino  Â·  3Comments

neeravp picture neeravp  Â·  3Comments