Beau Simensen Beau Simensen
Contributed by Beau Simensen and Beau Simensen in #8553

This might be a recurring theme in the Symfony world, but each version of Symfony makes debugging common problems easier. This time, it's all about class not found and undefined function PHP errors.

Whenever PHP yells at you because of a missing class, you need to figure out the problem; it might be a typo, or you might have forgotten the use statement, or you might have forgotten to install a dependency.

As of Symfony 2.4, and only in the development environment, we give you better error messages than PHP when such errors occur, like when using the Request class without adding the corresponding use statement:

"Attempted to load class 'Request' from the global namespace in foo.php line 12. Did you forget a use statement for this class? Perhaps you need to add 'use Symfony\Component\HttpFoundation\Request' at the top of this file?"

Have a look at #8553 as the error message is tweaked depending on the context of the error.

Published in #Living on the edge