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?

0
4 comments
Avatar
Permanently deleted user

Hello,

I could not reproduce this issue - no such error for me with this code.

Does this error come from some 3rd-party plugin?

0
Avatar
Permanently deleted user

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.

0

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?

0
Avatar
Permanently deleted user

Could you also run File > Invalidate Caches/Restart > Invalidate and Restart, please, and then check if the issue reoccurs?

0

Please sign in to leave a comment.