dx

The DX Files: Defined constants as API arguments

Barry Jaspan's picture

This is part two of my series, The DX Files: Improving Drupal Developer Experience.

Many Drupal APIs accept a boolean argument (TRUE or FALSE) to determine some behavior. I believe that practice should be banned in all but exceptional cases, instead using a defined constant with a descriptive name.

Here is a perfect example from Drupal core:

The DX Files: Improving Drupal Developer Experience

Barry Jaspan's picture

I am declaring a personal crusade to improve Drupal’s “Developer Experience,” which I hereby abbreviate as “DX.”

read more

Syndicate content