<?php
declare(strict_types=1);
error_reporting(E_ALL);
class ClassWithTypedProperty {
public int $number;
public function __construct() {
$this->number = 1234;
}
public function __set($name, $value) {
printf("UNEXPECTED SETTING OF %s\n", $name);
}
}
printf("\n--- Typed Property ---\n");
var_dump(new ClassWithTypedProperty());
Parse error: syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/r5CBW on line 8
Process exited with code 255.