Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Another "uninitialized" thing..
$foo = new class() {
var ?array $a;
function dump() { var_dump($this->a); }
function sort() { ksort($this->a); }
// E1: Error: Typed property class@anonymous::$a must not be accessed before initialization
// E2: TypeError: ksort() expects parameter 1 to be array, null given (should throw E1 cos its an uninitialized property?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.