Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse PDT: Syntax Errors with valid PHP Namespace Syntax

I'm using Eclipse 3.6 (Helios) with PDT 2.2, and I'm getting syntax errors when trying to "use" namespaces.

Is there something I can do to fix this?

Example:

use Tables\Exceptions\Exception as Exception;

The PHP Parser recognizes "Tables" as a syntax error on this line and others like it.

like image 525
Brian Lacy Avatar asked Feb 23 '23 20:02

Brian Lacy


1 Answers

This is probably related to your interpreter settings in Eclipse.

Go to the Project menu and select Properties. Once you have the Properties screen up you can go to PHP Interpreter and adjust the PHP Version, either at the project level or the Workspace level.

Set the PHP Version to 5.3 or higher for proper highlighting.

If your project is in PHP 5.2 than you won't be able to use namespaces. See here: Namespaces in php 5.2

like image 150
mattcan Avatar answered Feb 25 '23 13:02

mattcan