Eclipse PDT: Syntax errors with valid PHP namespace syntax

I use Eclipse 3.6 (Helios) with PDT 2.2, and I get syntax errors when trying to “use” namespaces.

Is there something I can do to fix this?

Example:

use Tables\Exceptions\Exception as Exception; 

PHP Parser recognizes Tables as a syntax error on this line, while others like it.

+4
source share
1 answer

This is probably due to your interpreter settings in Eclipse.

Go to the Project menu and select Properties . When the Properties screen appears, you can go to PHP Interpreter and configure the PHP version at the project level or workspace level.

Set PHP version 5.3 or higher for proper highlighting.

If your project is in PHP 5.2, you will not be able to use namespaces. See Here: Namespaces in php 5.2

+8
source

All Articles