diff --git a/rules/S1781/php/rule.adoc b/rules/S1781/php/rule.adoc index 1b38f438b4b..e26e6cde201 100644 --- a/rules/S1781/php/rule.adoc +++ b/rules/S1781/php/rule.adoc @@ -6,6 +6,8 @@ This allows for more flexibility and ease of use when writing code. However, it is generally recommended to follow a consistent casing convention for readability and maintainability purposes. Relevant constants are `true`, `false` and `null`. +Note that if the Drupal framework is detected, this rule will enforce Drupal standards instead. Relevant constants are `TRUE`, `FALSE` and `NULL`. + === Noncompliant code example @@ -14,6 +16,13 @@ Relevant constants are `true`, `false` and `null`. ---- +[source,php,diff-id=2,diff-type=noncompliant] +---- + +---- === Compliant solution @@ -22,10 +31,20 @@ Relevant constants are `true`, `false` and `null`. ---- +[source,php,diff-id=2,diff-type=compliant] +---- + +---- + == Resources + === Documentation -* https://www.php.net/manual/en/reserved.constants.php[PHP Manual - Predefined Constants] +* https://www.php.net/manual/en/reserved.constants.php[PHP Manual - Predefined Constants] +* https://www.drupal.org/docs/develop/standards/php/php-coding-standards#s-constants[Drupal - Naming Conventions - Constants] ifdef::env-github,rspecator-view[]