Handling empty heaps

Code
<?php

$heap 
= new SplMinHeap();

// empty heap is not allowed
try {
    
$heap->top();
}
catch (
RuntimeException $e) {
    echo 
'Exception: heap is empty' PHP_EOL;
}

// empty heap is allowed and possible
if ($heap->isEmpty()) {
    echo 
'isEmpty says that the heap is empty';
}
Result
Exception: heap is empty
isEmpty says that the heap is empty
Used Versions
PHP 8.0, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8