1.2.1416. Uses PHP 8 Match()¶
This rule reports usage of the the match() syntax.
match() was introduced in PHP 8.0, and is an alternative to switch(). It is also not backward compatible with previous versions of PHP.
<?php
$A = match($a) {
'a' => 'A',
'b' => 'B',
default => 'd',
};
?>
See also match and Match expression.
1.2.1416.1. Connex PHP features¶
1.2.1416.1.1. Specs¶
Short name |
Php/UseMatch |
Rulesets |
|
Exakat since |
2.1.4 |
PHP Version |
With PHP 8.0 and more recent |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Related rule |
|
Available in |