<?php
class SomeArray extends ArrayObject {
public function offsetExists($offset) {
var_dump('Called: '.__METHOD__);
return parent::offsetExists($offset);
}
public function offsetGet($offset) {
var_dump('Called: '.__METHOD__);
return parent::offsetGet($offset);
}
public function offsetSet($offset, $value) {
}
public function offsetUnset($offset) {
}
}
$array = new ArrayObject(array('foo' => ''));
var_dump(isset($array['foo']), empty($array['foo']));
$array = new SomeArray(array('foo' => ''));
var_dump(isset($array['foo']), empty($array['foo']));
Deprecated: Return type of SomeArray::offsetExists($offset) should either be compatible with ArrayObject::offsetExists(mixed $key): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/PrQ80 on line 5
Deprecated: Return type of SomeArray::offsetGet($offset) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/PrQ80 on line 10
Deprecated: Return type of SomeArray::offsetSet($offset, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/PrQ80 on line 15
Deprecated: Return type of SomeArray::offsetUnset($offset) should either be compatible with ArrayObject::offsetUnset(mixed $key): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/PrQ80 on line 18
bool(true)
bool(true)
string(31) "Called: SomeArray::offsetExists"
string(31) "Called: SomeArray::offsetExists"
string(28) "Called: SomeArray::offsetGet"
bool(true)
bool(true)
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/PrQ80 on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/PrQ80 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/PrQ80 on line 5
Process exited with code 255.