Warn on "parent" without parent at compile-time by morrisonlevi · Pull Request #3404 · php/php-src
This adds a compile-time warning of level E_STRICT to usages of parent in class-scope where the class does not have a parent, e.g.
class InvalidClass { function method() { echo parent::class; } }
This currently has two test failures where the E_STRICT is emitted twice. I was not sure if the check was always redundant or if in some cases it isn't. I am hoping a reviewer will know better than me.
If a method definition like this is executed it generates a runtime error, so this should not be a controversial change. In PHP 8.0 we should change this from E_STRICT to an E_COMPILE_ERROR.