Ahref Links warnings in editor

I'm sorry for such easy question.
When I use this in phpStorm 4

echo ' <a href  = "/mycontroller/myaction"> my controller action</a>
inside my codes I get this warning:
Cannot resolve directory 'myfolder'

Cannot resolve file' myaction '

But they are controllers of my cakePHP site, so they don't exist as folder and file names.
How can I solve this warning?
Thank you in advance.

1 comment
Comment actions Permalink

Hi there,

Because you are outputting this string via echo, the text between quotes is recognized as HTML because appropriate language is injected there (it should have light green background, if using default color scheme).

There are 2 possible solutions:

  1. (applicable to your case -- echo 'something'): Uninject the auto-injected language, so the text is treated as plain text -- Alt+Enter and choose appropriate option .. or Settings | Language Injections --> <html> to disable it everywhere
  2. Disable appropriate inspection (globally or per custom scope): Settings | Inspections | HTML | Unknown href target

Recently PhpStorm has received initial (and very basic) support for MVC Frameworks (currently Symfony2 and Yii). When this will function properly and your framework will be supported, I would expect to PhpStorm handle such situation automatically by resolving such URL to proper contorller/action (so no warning is shown).


Please sign in to leave a comment.