[web-php] master: Enhancement: Enable `no_superfluous_elseif` fixer (#884)
| From: | Andreas Möller via GitHub | Date: | Thu, 07 Dec 2023 14:34:45 +0000 |
| Subject: | [web-php] master: Enhancement: Enable `no_superfluous_elseif` fixer (#884) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31248@lists.php.net to get a copy of this message | ||
Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2023-12-07T15:21:04+01:00
Commit: https://github.com/php/web-php/commit/ec908ce24648467e9a0ac1f55675b0283197ed92
Raw diff: https://github.com/php/web-php/commit/ec908ce24648467e9a0ac1f55675b0283197ed92.diff
Enhancement: Enable
no_superfluous_elseif fixer (#884)
Changed paths:
M .php-cs-fixer.php
M include/layout.inc
Diff:
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index c6f1f79705..117c0114e0 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -42,6 +42,7 @@
'no_extra_blank_lines' => true,
'no_mixed_echo_print' => true,
'no_singleline_whitespace_before_semicolons' => true,
+ 'no_superfluous_elseif' => true,
'no_trailing_whitespace' => true,
'ordered_class_elements' => true,
'random_api_migration' => true,
diff --git a/include/layout.inc b/include/layout.inc
index 89b1d2dbe7..73f9e20ecf 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -212,9 +212,9 @@ function sect_to_file($string) {
$feat = "features.$string.php";
$struct = "control-structures.$string.php";
if (@is_file($func)) return $func;
- elseif (@is_file($chap)) return $chap;
- elseif (@is_file($feat)) return $feat;
- elseif (@is_file($struct)) return $struct;
+ if (@is_file($chap)) return $chap;
+ if (@is_file($feat)) return $feat;
+ if (@is_file($struct)) return $struct;
else return "$string.php";
}