xp-framework / core

The XP Framework is an all-purpose, object oriented PHP framework.
Other
19 stars 6 forks source link

Add support for PHP 8.1 readonly properties #278

Closed thekid closed 3 years ago

thekid commented 3 years ago

This pull request implements support PHP 8.1 readonly properties as defined in https://wiki.php.net/rfc/readonly_properties_v2

class Test {
  public function __construct(public readonly int $prop = 0) { }
}

$test= new Test(6100);
$test->prop; // 6100
$test->prop= 6101; // Raises error
thekid commented 3 years ago

Released in https://github.com/xp-framework/core/releases/tag/v10.13.0