My IDE (PHPStorm) is unable to figure out e.g. response()->json()
response() (from Illuminate/Foundation/helpers.php) uses Routing\ResponseFactory to generate a response object, much like the Resonse facade used to do in L4.
Yes that would be really cool :+1:
response()->json() works fine for me.
Did you index the entire vendor folder? As long as the helpers have proper phpdocs (which response() has) it shouldn't be a problem.
Oh sorry, response()->json() seems to work, but for example session() has no autocomplete.
response()->* is working for me now. Perhaps I just had some indexing issue locally.
@michaelpittino What would you be looking for from session()? It just returns whatever you've stored in the session, there's no way to predict that. I do get parameter info for the function.
Should session() not be a short function for the Session Facade?
Yes, of course, sorry I read it wrong.
Anyone got the helpers working? I am on laravel 5.0 and did the generate command with --helpers. Still get method not found for redirect()->to(...);
@barryvdh: I've got the same issue with helper functions in PHPStorm 2016.1.
But as I've figured out - problems are only if we're not in the global namespace.
For example, request()->json() works fine in your routes.php file.
But it wouldn't - in your FooController, which is in App\Http\Controllers namespace by default.
\request()->json() - this works anywhere.
So, probably, this is an issue of PHPStorm? What do you think?
Thanks and have a great day!
PS: Does actually --helpers flag should be able to fix that?
Because I've tried it - and had no result with it enabled.
God, how many of these issues we have here? :D
Yes, its PhpStorm 2016 related issue. And no, you shouldn't be forced to FQNS every helper/function call like that. I recommend waiting for 2016.1.1 or later versions until that gets fixed, and stick to 10.x.
Now, please let's close this issue!
See: #340
CC: @barryvdh
@barryvdh as last comment said, this was related to older PhpStorm version => pretty sure this can be closed :}
+1
There's no such problem in the recent versions of PHPStorm 馃憤