6

I am seeing namespace errors all over the place and I am not sure why.

For exampe I have: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; and Configuration is in red and the error reads:

Undefined namespace Configuration less... (Ctrl+F1) 
Referenced namespace is not found.

How do I fix this?

3
  • 4
    Confirm you have files in your vendor folder, if not run composer install to add them Commented May 22, 2016 at 5:12
  • I noticed that it did not install my vendor folder locally. I am using a remote server for my local environment. I am going to download the vendor folder to my local machine and see if that helps. Commented May 23, 2016 at 15:08
  • That was my issue. I was missing the vendor folder. Commented May 23, 2016 at 22:15

2 Answers 2

5

Since you say "Configuration is in red" I assume the problem you are experiencing is related to the IDE

If you are using PHPStorm there's a specific Symfony plugin that handle all the namespacing pretty much automatically, as long as your setup is standard. By standard I mean a project dir containing the app/ src/ web/ ... dirs (if you're using the 2.x Symfony dir layout)

This link will tell you everything you need, in great detail

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

Comments

1

It may be your .idea folder which is corrupted. Close your project, delete the .idea folder and restart the IDE. It worked for me.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

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.