diff --git a/language/oop5/visibility.xml b/language/oop5/visibility.xml index 465f7f87fe5c..93418b7a0380 100644 --- a/language/oop5/visibility.xml +++ b/language/oop5/visibility.xml @@ -79,7 +79,7 @@ $obj2->printHello(); // Shows Public2, Protected2, Undefined Asymmetric Property Visibility - As of PHP 8.4, properties may also have their + As of PHP 8.4, object properties may also have their visibility set asymmetrically, with a different scope for reading (get) and writing (set). Specifically, the set visibility may be @@ -122,6 +122,42 @@ $b->pubYear = 2023; // Fatal Error ]]> + + As of PHP 8.5, set visibility may also be applied to static properties of classes. + + + Asymmetric Static Property Visibility + +doAThing(); // Works +echo Manager::$calls; // Works +Manager::$calls = 5; // Fatal error +?> +]]> + + &example.outputs; + + + + There are a few caveats regarding asymmetric visibility: