4

I have some problem with my PhpStorm (ver 2020.2). You can see on pictures, models, controllers and namespaces aren't recognized by PhpStorm, but application is working perfect.

Someone knows how to fix that problem in PhpStorm?

Namespaces

Controllers

5
  • 1
    1) What the warning/error is? What does it show when you hover over? Show a screenshot of it) 2) Have you tried File | Invalidate Caches and restart IDE? Commented Dec 3, 2020 at 10:43
  • Error is: undefined class (for controllers and models) and undefined namespace (for namespaces). Commented Dec 3, 2020 at 11:35
  • I tried File | Invalidate Caches but nothing happens. Same problem. Commented Dec 3, 2020 at 11:40
  • Did you do that with IDE restarting? If you did -- try manually deleting the cache, see instructions here: stackoverflow.com/a/64071021/783119 . If still nothing -- try disabling ALL custom (not bundled by default) plugins -- some of them may cause similar kind of issues. Commented Dec 3, 2020 at 11:42
  • I solved with answer below and it works. Thanks a lot man for helping me. :) Commented Dec 3, 2020 at 11:46

2 Answers 2

17

For me, the solution was to close IDE from File > Close Project, then remove .idea folder rm -rf .idea from terminal, and finally reopening it fixed the issue.

Sign up to request clarification or add additional context in comments.

1 Comment

It restored the problem again after a while. But then, when it suggests to put the folders of project and IDE as excluded for antivirus checks I didnt pickup Automatically . Chose Manually instead. And now its allright
10

You have to define the namespaces in the Settings
Go to Settings > Directories and edit the properties for each namespace enter image description here

On the Source Folders edit the prefix to be App\

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.