Top
image credit: Unsplash

PHP 8.2 introduces read-only classes

December 13, 2022

Via: InfoWorld

A major update to the stalwart scripting language for web development, PHP 8.2 has arrived with performance, syntax, and type safety improvements along with new capabilities such as read-only classes and stand-alone types.

PHP 8.2 was published December 8 and can be accessed from php.net.

Support for read-only classes in PHP 8.2 means that a class marked with the readonly modifier will mark all instance properties of the class as read-only and prevent the creation of dynamic properties. Marking readonly classes with the AllowDynamicProperties attribute triggers a compile error.

Read More on InfoWorld