I wanted to update my original suggestion. I wrote:
... check the syntax whenever the editor insertion point moves away from a line that has changed.
Then I defined "changed" as meaning adding, deleting, or editing a line.
My new thought is that adding or deleting
a blank line should not count as an added or deleted line because blank lines do not affect syntax in PHP (or CSS, HTML, JS, etc.).
I mention this because I have noticed that the pink highlight for an error line can vanish quickly when typing continues. I would like that highlight to remain as long as possible, so I thought about the conditions under which the highlight would be removed. I think that should be when the next syntax check happens and that means it is important make sure that no extraneous syntax checks are initiated to give the coder has as much time as possible to notice that an error has been found.
I can't speak to Blumentals' code and I might be wrong about this, but I think the idea of only invoking a syntax check when something has actually changed will reduce syntax checking overhead. The definition of "changed" means that the modification is one that can affect syntax and my new realization is that adding or deleting blank lines does not affect syntax, a statement that applies not only to PHP but also to CSS, HTML, and JS.
Finally, if a line with an error is highlighted (which in my scenario means that no subsequent syntax check has been invoked) and the user saves/closes the file, automatically run a syntax check. I have not carefully thought out the implications of this. I don't want the editor telling me I can't close the file but I also don't want to close a file thinking everything is okay when it isn't.