Use PHP 8.1 Enums, Readonly Properties, and Intersection Types in WordPr ...
PHP 8.1 enums, readonly properties and intersection types in a WordPress plugin PHP 8.1 brought three features that make plugin code stricter with little effort. Enums replace groups of string constants, so an invalid status is a type error instead of a silent bug. Readonly properties make value objects that cannot change after construction. Intersection…