mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects This also moves tests into a subfolder.
18 lines
330 B
PHP
18 lines
330 B
PHP
--TEST--
|
|
SPL: ArrayObject with overridden count()
|
|
--FILE--
|
|
<?php
|
|
$obj = new ArrayObject(array(1,2));
|
|
var_dump(count($obj));
|
|
class ArrayObject2 extends ArrayObject {
|
|
public function count(): int {
|
|
return -parent::count();
|
|
}
|
|
}
|
|
$obj = new ArrayObject2(array(1,2));
|
|
var_dump(count($obj));
|
|
?>
|
|
--EXPECT--
|
|
int(2)
|
|
int(-2)
|