xref: /PHP-8.4/ext/spl/tests/heap_010.phpt (revision c6357b80)
1--TEST--
2SPL: SplHeap with overridden count()
3--FILE--
4<?php
5$obj = new SplMaxHeap();
6$obj->insert(1);
7$obj->insert(2);
8var_dump(count($obj));
9class SplMaxHeap2 extends SplMaxHeap{
10    public function count(): int {
11        return -parent::count();
12    }
13}
14$obj = new SplMaxHeap2();
15$obj->insert(1);
16$obj->insert(2);
17var_dump(count($obj));
18?>
19--EXPECT--
20int(2)
21int(-2)
22