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