There should be a space between attribute and previous attribute

Take this example:

<?php
if($somevar) {
     $class_code = " class=\"active\"";
} else {
     $class_code = "";
}
echo "<img src=\"/img/somefile.jpg\" alt=\"\" width=\"50\" height=\"50\"{$class_code} />";
?>

The phpStorm 7 inspector is warning on the open bracket for {$class_code} saying: "There should be a space between attribute and previous attribute"

I have HTML inspections comnpletely turned off.

Why will this error not go away? I code like this very often. The space is included in the variable, that way, when its empty there is not an extra space in the markup. Maybe its nit-pickey of me or maybe its OCD but I like when my generated coded is formatted correctly.

0

This is a low-level lexer check; it can't be turned off unless you disable error highlighting for the file using Hector icon (change highlighting level to none)

-1

Thank you. I will just add the extra space then. Who knows, it may not even end up in the output. I'll have to double check how that's handled for my own curriosity.

0

This is wrong behavior. for example, valid php code with complex regexp generate this error.

It would be great to have ability to disable this partiicular warning for some file

3

Wrong behaviour indeed. Please leave us a bit of freedom and allow to disable this warning.

0

请先登录再写评论。