I'm blogging about Emacs, Drupal, php and exciting subjects

PHP Enums in Depth: Backed Enums, Methods, and Interfaces

PHP 8.1 introduced enums as a first-class language feature. After a few years in the wild they are well-supported across frameworks, Drupal, and static analysis tools — but many PHP developers still use constants or pseudo-enum classes out of habit.

PHP Attributes in Drupal 11: Replacing Annotations in Plugins and Hooks

For years Drupal used docblock annotations — special comments parsed at runtime by the Doctrine Annotations library — to declare plugins, entity types, and field formatters. PHP 8.0 introduced native attributes as a first-class language feature, and Drupal 11 now supports them everywhere annotations were used.

Subscribe to Linkhub