Isn't that only when you have html within the if/foreach?
This is just an if inside a php block. No html output inside the if.