I think these two lines are OK using inline conditionals.  Our layout files have selective enforcement of many of the PHPCS rules due to the mixed HTML/PHP nature which causes a lot of false failures otherwise.