use mode delegates in PHP

fixes #2197
the error here is because this is called on outer HtmlMode, and indentation is broken in PhpMode