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 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6