Static Properties With Asymmetric Visibility

Asymmetric visibility was introduced in version 8.4. In that version, the asymmetric visibility was limited to non-static properties. In PHP 8.5, that feature is now extended to static properties.

PHP code

<?php

class x {
    public private(set) static int $a = 3;
}

?>

Before

PHP Fatal error:  Static property may not have asymmetric visibility

Fatal error: Static property may not have asymmetric visibility

After


PHP version change

This behavior changed in 8.5-

Error Messages