Обработка ошибок на php

Учусь обрабатывать ошибки, этот код выдает ошибку, которую, как я понял, нельзя обработать:

Uncaught TypeError: Argument 2 passed to Student::__construct() must be of the type array, integer given, called in... Также функция onErrorFunction() не выводит текст. Что я сделал или понял не так?

function onErrorFunction() {
    echo "Enter correct value";
}

set_error_handler('onErrorFunction');

Class Student {
    public $name;
    public $results;

    public function __construct($name, array $array) {
        echo "Student ".$name.":";
        foreach ($array as $subject => $item) {
            echo "<br>$subject: $item";
        }
        echo "<hr>";
    }
}

$student1 = new Student("User1", ["math" => 10, "english" => 11]);
$student2 = new Student("User2", ["math" => 9, "english" => 9]);
$student3 = new Student("User3", 1);

Ответы (0 шт):