PHPStorm inspection flagging variables in string creation
I have code like the following to create a select entry;
$select .= "<option value=\"{$country['code']}\" {$selected}>".htmlentities ($country['name'])."</option>";
I get the following warning "Attribute EXTERNAL_FRAGMENT is not allowed here". How do I permanently suppress that warning and still check for other bad attributes?
Please sign in to leave a comment.
Hello,
I could not reproduce this issue - no such error for me with this code.
Does this error come from some 3rd-party plugin?
Nope, I am just using the built in Code>Inspect Code. Are you sure you are checking for allowed attributes? It can be suppressed through Settings>Editor>Inspections>HTML>Unknown HTML tag attribute.
I think the problem is the '{$selected}'. That is not a valid attribute but since it is a PHP variable it should be ignored.
I'm also unable to reproduce.
Try that assignment in a blank file + another project - would that get reproduced? Also what is the extension/file type of a file: php or html?
Could you also run File > Invalidate Caches/Restart > Invalidate and Restart, please, and then check if the issue reoccurs?