Eclipse compilation errors when enabling semantic analysis on SPL classes

1.1k views Asked by At

I have a PHP project which I develop with Eclipse. Project is hosted on GitHub: https://github.com/elgervb/compact/.

When I enable Semantic Analysis (Window -> Preferences -> PHP -> Semantic Analysis), then I get all kinds of compilation errors regarding the Standard PHP Library (SPL).

It seems it cannot find all SPL classes. Error typically shown in the error view:

The type ArrayObject cannot be resolved FileRepository.php /compact/classes/compact/repository/file line 320 DLTK Problem

The type Closure cannot be resolved Router.php /compact/classes/compact/routing line 33 DLTK Problem

The type \PDO cannot be resolved AbstractPDORepository.php /compact/classes/compact/repository/pdo line 41 DLTK Problem

... and many, many more.

I have Zend Eclipse for PHP Developers, version: 3.2.0. My project has PHP Support. The PHP Language Library is on my build path, that contains the Core API, which has the SPL.php file.

Does anyone know how to resolve this, as I clearly want to use semantic analysis? Does anyone has experienced these problems too?

2

There are 2 answers

0
Elger van Boxtel On BEST ANSWER

I've found the solution. When I enabled PHP Core Facet and PHP Facet on my project it worked.

Goto project -> properties -> Project Facets and enable both facets..

0
tiagonogueirax On

"Project > Clean" Works me works for me when Facets are enabled, but there is an error.