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

Jdagger's avatar

Updating to Laravel 11 gives a lot of undefined classes/methods - everything still works as intended

Today I've tried upgrading to Laravel 11, but as the title suggests I am having some issues with classes and methods being "undefined". These methods are all imported and worked before upgrading to 11. I can work around it to some extend but it's really quite the eyesore. Is this a known problem?

I've tried reimporting every class on my includes for every file I open. Sometimes this worked but not for all classes. Anyone else with this problem? Thanks a lot in advance!

0 likes
6 replies
gych's avatar

Did you already try to run composer dump autoload

1 like
Jdagger's avatar

@gych returned "No arguments expected for "dump" command, got "autoload"." and a line of usage helper code, but didn't do anything for me

Snapey's avatar

@Jdagger the command is composer dump-autoload but can be shortened to composer dump

Its a useful command to know as it might be needed if you rename files or correct the name of classes

1 like
gych's avatar

@Jdagger Sorry my bad, I made a typo there, its indeed composer dump-autoload or the shorter alternative like @snapey explained

Snapey's avatar
Snapey
Best Answer
Level 122

if VScode, try Index Workspace command

1 like
Jdagger's avatar

@Snapey dude, you're the man! I don't know what happened and I will read into it, but for now I'm not getting any undefined elements from intelliphense anymore. Thank you so much!

edit: I didn't know what you meant with the VS command but apparently VS can run commands under the 'Terminal' tab of your tool/navigation bar

Please or to participate in this conversation.