PHP 8.0 has a new feature that automatically promotes class constructor parameters to corresponding class properties with the same name if the constructor parameters are declared with a visibility modifier and are not of type. The new feature adds support for enumerations, or enums, to declare an enumerated set of values that are similar to class objects.

22m read timeFrom infoq.com
Post cover image
Table of contents
Read-Only Class PropertiesConstructor property promotionObjects use in define()Class constants may be declared finalThe special ::class constant can be used on objectsInterfaces constants can be overriddenAutoload function __autoload() is removedEnumsHow enums are similar to classesBacked enumsEnums may include methods and implement an interfaceEnums may declare static methodsEnums may declare constantsEnums with traitsHow are enums different from classesAbout the Author
2 Comments

Sort: