
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
The `elseif` keyword is preferred over the `else if` keywords in PHP due to its consistency with other programming languages.
|
|
|
|
`elseif` is a single token, making it more efficient for the PHP parser to process. Additionally, using `elseif` encourages developers to follow a unified coding style and maintain a consistent syntax throughout their PHP codebase.
|
|
|
|
Overall, the use of `elseif` improves code clarity, reduces potential errors, and enhances the overall maintainability of PHP projects.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,php,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
if ($expr1) {
|
|
...
|
|
} else if ($expr2) {
|
|
...
|
|
} else {...}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,php,diff-id=1,diff-type=compliant]
|
|
----
|
|
if ($expr1) {
|
|
...
|
|
} elseif ($expr2) {
|
|
...
|
|
} else {...}
|
|
----
|
|
|
|
== Resources
|
|
=== Documentation
|
|
* https://www.php.net/manual/de/control-structures.elseif.php[PHP Manual - elseif/else if]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Replace this "else if" keyword sequence by "elseif" keyword.
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|