PHP stack with SplStack

Code
<?php

// LIFO by default
$list = new SplStack();

try {
    
// unlike SplDoublyLinkedList you can't change direction
    
$list->setIteratorMode(SplStack::IT_MODE_FIFO);
}
catch(
RuntimeException $e) {
    echo 
$e->getMessage() . PHP_EOL;
}

try {
    
// but you can't change KEEP to DELETE either
    // Is the PHP documentation wrong?
    
$list->setIteratorMode(SplStack::IT_MODE_DELETE);
}
catch(
RuntimeException $e) {
    echo 
$e->getMessage() . PHP_EOL;
}

// LIFO needs to be readded again to prevent an exception
$list->setIteratorMode(
    
SplStack::IT_MODE_LIFO |
    
SplStack::IT_MODE_DELETE
);


// adding elements with push or unshift
$list->push(1);
$list->push(10);
$list->push(100);

foreach (
$list as $element) {
    echo 
$element PHP_EOL;
}

echo 
'count: ' count($list);
Result
Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
100
10
1
count: 0
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6