Andy Wallace
Andy Wallace

Reputation: 689

Eclipse Neon php - "Exception cannot be resolved to a type"

Ok, so this worked earlier today...

My Eclipse has turned on me. Earlier today, everything was fine. We had some networking issues, so I shut Eclipse down, waited for the all clear, and restarted.

Suddenly, Eclipse decided that almost ALL my source files had errors in them. Looks like it is suddenly working within namespaces. I get dozens and dozens of " cannot be resolved to a type" error in the source code.

So, I prepended the "\" character onto class names in one of the offending files, and things got better, but still things like Exception and PDO give the error. Even though I have modified the line like so:

throw new \Exception("Error - $acnt is not an account in the $source database");

We have a very big system, and because of these errors, I have dozens of checked out files that are giving me a commit error when I try to check them in, which is going to slow things down a tad. Any ideas:

1) why this suddenly started happening? 2) how I can "fix" this behavior?

thanks...

Upvotes: 0

Views: 3313

Answers (3)

Olav Hovet
Olav Hovet

Reputation: 1

Rightclick project (or use Project/Properties), then go PHP/Source Paths/Build Path

Included probably says (All), Excluded probably says (None). Edit Included, and add the wildcard * for the project.

Solved all errors and warnings for me.

Upvotes: 0

Patrick
Patrick

Reputation: 81

When I create a new project I see the same warning. If I touch .buildpath in the root directory of the project and restart eclipse, then the warning goes away.

Upvotes: 0

Andy Wallace
Andy Wallace

Reputation: 689

And as quietly and quickly as it appeared, it disappeared. I opened a new file, and suddenly, all the little red Xes disappear. Grrr... Eclipse.

Upvotes: 1

Related Questions