1.2.1405. Uses PHP 8 Match()

Use the match() syntax.

<?php


$A = match($a) {
    'a' => 'A',
    'b' => 'B',
    default => 'd',
};

?>

See also match and Match expression.

1.2.1405.1. Specs

Short name

Php/UseMatch

Rulesets

All, CE, CompatibilityPHP74

Exakat since

2.1.4

PHP Version

With PHP 8.0 and more recent

Severity

Time To Fix

Precision

Very high

Features

match

Related rule

Reserved Match Keyword

Available in

Entreprise Edition, Community Edition, Exakat Cloud