Drupal is one of the few (the only?) project that uses TRUE, FALSE and NULL uppercase in code in 2024.
Actually that is not even consistent: in PHPDoc when describing union types, the lowercase version is used.
We have plenty of code like (example)
/**
* Sort.
*
* @param int|null $flags
* The flags to sort.
*
* @return true
* Always return TRUE if no exceptions are thrown.
*
* @throws \Exception
* When...
*/
public function sort(int|NULL $flags = NULL): TRUE {
This is confusing, but enforced via Coder, and non-Drupalers can get frustrated by this so in fact a barrier to contribution.
I propose to give in to the siege, lowercase these everywhere, and celebrate the invaders:
/**
* Sort.
*
* @param int|null $flags
* The flags to sort.
*
* @return true
* Always return TRUE if no exceptions are thrown.
*
* @throws \Exception
* When...
*/
public function sort(int|null $flags = null): true {
If we adopted this change, the Drupal Project would benefit by ...
Provide all proposed changes to the Drupal Coding standards → . Give a link to each section that will be changed, and show the current text and proposed text as in the following layout:
Add current text in blockquotes
Add proposed text in blockquotes
For a full explanation of these steps see the Coding Standards project page →
Active
Coding Standards