为什么这个error_handler函数返回NULL?

I have a class called Error which when loaded will register a function called errorHandler using the set_error_handler method in PHP. However, this function will return NULL if the function fails to load or if PHP is using the default built-in error handler. I cannot figure out why my function is not being accepted. Does anyone have any good guesses?

<?php
declare (strict_types = 1);

namespace Request\Configuration;

use Errors\Exception\FatalException;

class Error extends Template
{
    public static function load(): void
    {
        $result = set_error_handler('self::errorHandler', error_reporting());
        var_dump($result);
    }

    public static function errorHandler(
        int $number,
        string $message,
        string $file = null,
        int $line = null,
        array $context = null
    ) {
        throw new FatalException('PHP_ERROR: ' . $message, 0);
    }
}

This class when loads returns NULL.

Ok, after much debugging and exploration I have found the reason for this. The set_error_handler() function will only return the current error handler function before the time of registering a new one. It's a strange functionality. So if you want to find out if it was successfully registered you have to call this function twice. So when this function was returning NULL it was because the previously registered function was PHP's built-in one so it simply returned NULL. Watch out for this one, it's a weird function.