1.2.134. Class Const With Array¶
This rule lists global and class constant that are defined with an array value. This feature was added in PHP 5.6.
<?php
const MY_ARRAY = array();
class x {
const MY_OTHER_ARRAY = [1, 2];
}
?>
1.2.134.2. Connex PHP features¶
1.2.134.2.1. Suggestions¶
Store the array in a variable
Upgrade to PHP 7.0 or more recent
1.2.134.2.2. Specs¶
Short name |
Php/ClassConstWithArray |
Rulesets |
All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55 |
Exakat since |
0.8.4 |
PHP Version |
With PHP 5.5 and more recent |
Severity |
Critical |
Time To Fix |
Slow (1 hour) |
Changed Behavior |
PHP 5.6 |
Precision |
Very high |
Available in |