0

I would like to ask e.g. if I have a code like this:

/**
 * Doc comment
 */
@Annotation
class MyClass {

}

I know it will generate a parse error cause PHP doesn't have annotations natively like Java (i.e. outside of comments), but anyway is there a way to make PhpStorm not to complain about it?

enter image description here

Can I disable anyhow that Expected: semicolon in PhpStorm? I mean something like disabling error checking for a pattern matching @[a-zA-Z]+ or something like that?

EDIT: @notulysses The Inspection window shows only Typo and Warning, how can I see the Errors too?

enter image description here

tonix
  • 6,671
  • 13
  • 75
  • 136
  • [Look at this](https://www.jetbrains.com/phpstorm/help/suppressing-inspections.html) – potashin Feb 03 '15 at 18:41
  • What purpose does that serve? Genuinely curious. – castis Feb 03 '15 at 18:42
  • @notulysses I have already looked at the link you linked me, the problem is that PhpStorm shows me only `Typo` (green inspection) and `Warning` (yellow inspection) but that `Expected semicolon` refers to an `Error` (a red inspection, I guess), and it is not shown in the *Inspection* window (please, check the picture in my edit). Can I also disable error inspections? If so, how? – tonix Feb 03 '15 at 18:53
  • @castis Found this answer SO quite interesting: http://stackoverflow.com/questions/3623499/how-is-annotation-useful-in-php#answer-23415342 – tonix Feb 03 '15 at 18:54
  • @castis If I paste that code in the answer linked above in the IDE editor everything after `__halt_compiler();` is not parsed by the IDE and I don't get any error, but I would like to separate those files and have that `AnnotationExample` class in a separate file, and edit it with the IDE, though with the `@cache` annotation or any other annotation maintaned. – tonix Feb 03 '15 at 19:00

1 Answers1

1

You cannot -- those errors come from Lexer/Parser which is a lower level than inspections (which you may suppress/disable completely on individual basis) and therefore is not suppressible (unless, you write your own PHP-alike language support plugin).

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • Thank you for the answer! Anyway, just to know how to do it, with `which you may suppress/disable completely on individual basis` you mean that they can still be suppressed/disable e.g. per-project? How can I do it? – tonix Feb 03 '15 at 19:33
  • How to do what? Disable inspections? Inspections are already project-specific setting .. so you just go to `Settings (Preferences on Mac) | Editor | Inspections` and disable unwanted. You can also disable them not for the whole project , but for specific scope only (e.g. certain folders or files). – LazyOne Feb 03 '15 at 20:11
  • Yes, I know I can disable `Typo` and `Warning` inspections form `Preferences | Editor | Inspections` but actually how can I disable a single `Error` like `Expected: semicolon`? If I search for them in the search field in `Preferences | Editor | Inspections` they doesn't show. – tonix Feb 03 '15 at 20:20
  • 1
    As I have said in my actual answer: this error you are referring to comes from a Lexer/Parser and is NOT suppressible AT ALL. Only inspections (which is a higher/additional/optional level) can be suppressed. – LazyOne Feb 03 '15 at 20:31
  • Aaah, all right, I didn't get it through and through! Thanks! – tonix Feb 03 '15 at 20:50