Required file lints incorrectly

Below #couponImage seems not to be detected within the HTML script

Also, this is a view file that is required into another PHP file where $imageUrl is defined. But Phpstorm doesn't detect this, linting $imageUrl with a red underline instead.

Any way to fix these to not show errors when the variables/ids are detected in the same file or near a require statement?

Phpstorm 2019.1 on Lubuntu 18.04

#couponImage { // grayed out. "Never used"
position: fixed;
bottom: 50px;
right: 5px;
border: 2px dashed black;

echo plugin_dir_url(__FILE__) . '../images/' . $imageUrl // $imageUrl undefined
. " " ?>
id='couponImage' /> <!-- orange background. "Can't resolve" -->
alt="A special coupon"


1 comment
Comment actions Permalink

Put PHP part in quotes:


<img src="<?php echo plugin_dir_url(__FILE__) . '../images/' . $imageUrl . " " ?>" id='couponImage' />

Please sign in to leave a comment.