Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincej's avatar
Level 15

PHPSTORM: Why do get "method not found in class" all the time ??

I'm using Barryvdh plugin and it works great, but within controllers, Storm keeps telling me all over the place, "method not found in class"

What can I do to fix it, other that turn off inspections.

Many Thanks !

0 likes
71 replies
mstnorris's avatar

Have you tried the Native Laravel Plugin? Also, just to check, have you added the following to your composer.json file? You need to run composer update after as that is what triggers the post-update-cmd to be run. Or you can do it manually, but that is rarely the case.

"scripts":{
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan ide-helper:generate",
        "php artisan optimize"
    ]
},
1 like
vincej's avatar
Level 15

HI @mstnorris

Thanks for the raoud reply ! I checked my composer file and noticed that "php artisan ide-helper:generate" was missing. However, adding it made no difference.

When you say "native laravel plugin" I'm not sure what you mean. I thought the Barry plugin was the ONE. However searching through Storm's plugin directory I see one from http://espend.de daniel@espendiller.net

Is this what you mean ?

If it is, do I just delete the Barry plugin from the vendor directory and remove the references from the composer file ?

Many thanks !

ps - I used to live near Hertford Town, until I emigrated :o)

1 like
mstnorris's avatar

I use both (I don't know what the benefit is but it works).

I don't know what your issue is as that should have sorted it.

Have you tried restarting PhpStorm and clearing the caches?

1 like
vincej's avatar
Level 15

Ok - I cleared the cache and restarted as suggested, nothing changed. The Laravel plugin that you are referencing is built by Daniel Espendiller. I have to browse respositories to find it.

Am I correct in thinking that all I have to do to purge the Barry plugin is just delete it from vendors and the composer file ?

mstnorris's avatar

Yes I believe so. That should have sorted it.

Are you using Mac or PC?

vincej's avatar
Level 15

Linux Mint on Intel PC ( once was ! )

jimmck's avatar

Can post your Controller code? And the specific error. Also how are you guys posting screen shots?

Thanks.

vincej's avatar
Level 15

I don't know how he is doing screen shots. The controller code does not give an error. Rather PHPStorm is giving me a notification. example:

  $data = input::all();

I get a squiggly line under "all" informing me of that the method "all" can not be found.

vincej's avatar
Level 15

I've always used google docs and done a share, but they do not show up on the page. only the url ... what gives, what are you doing different ?

mstnorris's avatar

@vincej use imgur

  1. You upload an image by dragging it onto the page or navigating to it through the file browser
  2. Imgur generates some links (it does pre-formatted markdown too!)
  3. Paste the code here :D
  4. Done.
1 like
vincej's avatar
Level 15

Thanks ! btw I gave you an award point :o)

cheers !

1 like
jimmck's avatar

@vincej Can you provide a little more context? One line of code is vague.

vincej's avatar
Level 15

@jimmck Hi, I'm not sure what else I can tell you, they are not errors, just notifications from PHPStorm telling me that it can not find the model when the model is indeed there and working fine. They show up all over your controller when it is referencing a model.

This is a Storm issue not Laravel issue. And I hope that when I install the new plugin suggested by mstnorris all will be fine.

cheers !

jimmck's avatar

So it is inside your controller? Uhm, I have all the plugins installed. You have listed input:all, where as Input is a Facade in app.php and Input::all() is ok in Storm So I have no context, so maybe you have a typo? Best ! Jim! And Thanks Bobby!

1 like
sitesense's avatar

Just wondering, although you added the php artisan ide-helper:generate command here:

"scripts":{
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan ide-helper:generate",
        "php artisan optimize"
    ]
},

Did you actually run composer update afterwards?

The post-update-cmd is just that. Those commands run each time you do composer update.

You can of course run it manually from the command line too php artisan ide-helper:generate.

You probably then need to wait until PHPStorm re-indexes your project.

1 like
vincej's avatar
Level 15

@sitesense Mark ! Yes, of course .. composer update did it .. all the error messages are gone !

sorry ntsnorris, but the award point now goes to sitesense.

Many thanks !

vincej's avatar
Level 15

Guys - I spoke too soon. I was celebrating after a Storm restart when all the Storm advice messages had not yet come up. As soon as I log into the Storm DB I get them all like a disease. Bummer.

jimmck's avatar

Some code would help. It could be a setting? Oh well. Good luck.

vincej's avatar
Level 15

@jimmck Here are the two offending code samples which particularly give an error .. but there is nothing functionally wrong. It works, it's just that Storm can not find the associated method. Many thanks !

  if($data['checkboxes']['0'] =='84'){
        Flash::error('You have attempted to delete the crew, "unallocated" This crew is reserved and can not be deleted.');
    }
 $data = input::all();
mstnorris's avatar

@vincej have you added your Directories within PhpStorm at all? That can help although the IDE helpers usually solve that. I think there is something else going on.

Your code isn't the culprit here.

vincej's avatar
Level 15

@mstnorris

have you added your Directories within PhpStorm at all?

Umm ... I'm a little new to Storm, so .. I have a bad feeling I have not done that. (Embarrassed) What does this mean, where do I do it ?

mstnorris's avatar

Everything in PhpStorm is searchable... Oh wait, you already gave the points to SiteSense... Hehe, just kidding.

So, everything is searchable, open up PhpStorm and start typing "Directories" and you will be able to designate what directories are used for what parts of your project so it can give you proper codesense.

As I mentioned above, the IDE helpers usually take care of all of this as I have't had to do this in a long time so it may/may not be worth it.

I'm off to bed now (I said that two hours ago!). G'night and good luck.

jimmck's avatar

I was just going to ask. Go to Settings->Projects->Directories... Make sure to add the Vendor directory and all the subdirs. Click Ok. Close Storm and restart. Also after you update composer do a restart. Storm is not goos at picking up changes.

jimmck's avatar

I am going to try this image thingy...

jimmck's avatar

Well so much for imgur, I have to login! No too busy for yet another login.

vincej's avatar
Level 15

I added the vendor directly. There are too many individual sub directories to add them all manually. Didn't do anything for me. what exactly does Storm mean by a "resource root" ?

jimmck's avatar

Make your resource root the laravel public dir. Its for your web stuff. The vendor is so the IDE can reference all the classes.

Next

Please or to participate in this conversation.