Cannot access parent:: when no class scope is active, while debugging

The following PHP code is given:

abstract class Foo {
    private $maxLen = 1;
    public function __construct( $maxLen ) {
        $this->maxLen = $maxLen;
    }
    public function setMaxLen( int $maxLen ) {
        $this->maxLen = $maxLen;
    }
    public function isValidName( string $name ) {
        $len = strlen( $this->formatName( $name ) );
        if ( $len > $this->maxLen ) {
            return false;
        }
        return true;
    }
    protected function formatName( string $name ) {
        return trim( $name );
    }
}
class Bar extends Foo {
    public function isValidName( string $name ) {
        return parent::isValidName( $name ) &&
               preg_match("/^[a-z]+$/i", $this->formatName( $name )) === 1 ? true : false;
    }
}
function validateNames( array $bars, string &$errorName = "" ) {
    // Validate post parameters
    foreach ( $bars as $bar ) {
        if (! $bar->isValidName("  Jo hn  ")) {
            $errorName = "Jo hn";
            return false;
        };
    }
    return true;
}
$singleFormParams = [
    new Bar(5),
    new Bar(4),
];
$errorName = "";
echo "Result: " . validateNames( $singleFormParams, $errorName );
echo $errorName;

The code doesn't throw an error when processing in normal mode, but if you set a break point in the following line: return parent::isValidName( $name ) && and then evaluate the value of the code part: preg_match("/^[a-z]+$/i", $this->formatName( $name )), let the code continue and you will get the error.

Why does debugging break the whole script here?

Fatal error: Uncaught Error: Cannot access parent:: when no class scope is active in \example.php on line 33
( ! ) Error: Cannot access parent:: when no class scope is active in \example.php on line 33
{main}( )                         ...\example.php:0
364440  validateNames( ???, ??? ) ...\example.php:42
364472  Bar->isValidName( ??? )   ...\example.php:30

https://3v4l.org/sfMDe