Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

Extension

© 2023-2026, Damien Seguy - Exakat