0

In CakePHP 3.x vendor folder Eclipse highlites a lot of lines with potential errors (even though in my opinion there are none), e.g.

namespace <%= $namespace %>\Controller<%= $prefix %>;

The example error message is as follows:

Multiple annotations found at this line
- syntax error unexpected "%="
- syntax error unexpected "<"

How can I turn off the errors? I already turned on "Use Short Tags" in Properties/Interpreter (didn't help).

Annabelle
  • 734
  • 9
  • 23
  • Possible duplicate of [How to exclude a folder that is producing warnings/errors in an Eclipse project?](http://stackoverflow.com/questions/3736208/how-to-exclude-a-folder-that-is-producing-warnings-errors-in-an-eclipse-project) – ndm Jun 16 '16 at 08:06
  • I don't think that's a duplicate - that's talking about Java source folders, not validation errors – AlBlue Jun 16 '16 at 08:27
  • I don't consider it as duplication either. – Annabelle Jun 16 '16 at 08:47
  • don't know in eclipse, but in NetBeans you have to check 'enable ASP tags' in the project options – arilia Jun 16 '16 at 09:54
  • maybe [this](http://www.eclipse.org/pdt/help/html/php_interpreter.htm) – arilia Jun 16 '16 at 10:08
  • I checked that button already - however it is called "Use Short Tags" in my Eclipse – Annabelle Jun 16 '16 at 10:16
  • @AlBlue and OP, sorry, I've pasted the wrong URL, I ment to link **http://stackoverflow.com/questions/2272237/how-to-exclude-specific-folders-or-files-from-validation-in-eclipse** – ndm Jun 16 '16 at 10:38
  • The resource filters are for ignoring the resources completely though, which may not be what's required here. – AlBlue Jun 16 '16 at 10:40
  • Yes, unfortunately that will not be a solution for me – Annabelle Jun 16 '16 at 15:55

1 Answers1

0

You should be able to turn off the validation for the file, by going to Preferences -> Validation and then unselecting the options that are using the XML validation (which won't understand tags like <%)

AlBlue
  • 23,254
  • 14
  • 71
  • 91
  • The problem still exist – Annabelle Jun 16 '16 at 08:47
  • First, try cleaning the project and see if the errors go away. Secondly, if that doesn't work, look in the 'problems' view and see what kind of error message it is (should say on the right something like "Java Problem" or "HTML Problem" - that will give a clue as to which type of validator is raising the problem. – AlBlue Jun 16 '16 at 08:49
  • Cleaning did not help (I did it several times). The message shows "PHP Syntax Error". And mostly "<%" , "<%=" , "%>" tags are highlited. Therefore I turned on "Use short tags" option, which did not work. – Annabelle Jun 16 '16 at 08:58
  • Ah, so it's not a validation error then :) Looking at the PHP preferences, the short tags are using the tag elements: http://help.eclipse.org/mars/topic/org.eclipse.php.help/html/reference/preferences/php_interpreter.html?cp=61_4_3_8 rather than <% which is presumably the Cakewalk reference. Are these in PHP files? – AlBlue Jun 16 '16 at 09:04
  • .ctp files actualy (but I added this extention) – Annabelle Jun 16 '16 at 09:09
  • [**Bake**](http://book.cakephp.org/3.0/en/bake.html) templates (which is what you are looking at) simply aren't valid PHP, even if the parser understands the [**ASP-style tags**](http://php.net/manual/en/ini.core.php#ini.asp-tags), the tags are nested, and therefore it's invalid syntax. The ASP style tags are used as placeholders for actual PHP tags that are being used when evaluating the template. @Annabelle – ndm Jun 16 '16 at 19:35