Orphaned Parent

Calling the parent class of a class without parent is not possible. It used to be a deprecated error, where the code would keep on executing. In PHP 8.0, it stops the execution entirely.

PHP code

<?php

class x {
        function __construct() {
                parent::__construct();
        }
}

new x;

?>

Before

Deprecated: Cannot use "parent" when current class scope has no parent

After

PHP Fatal error:  Cannot use "parent" when current class scope has no parent

PHP version change

This behavior was deprecated in 7.4

This behavior changed in 8.0

Error Messages