1.2.1114. Should Use Existing Constants¶
The following functions have related constants that should be used as arguments, instead of scalar literals, such as integers or strings.
<?php
// The file is read and new lines are ignored.
$lines = file('file.txt', FILE_IGNORE_NEW_LINES)
// What is this doing, with 2 ?
$lines = file('file.txt', 2);
?>
See also Bitmask Constant Arguments in PHP.
1.2.1114.1. Connex PHP features¶
1.2.1114.1.1. Suggestions¶
Use PHP native constants whenever possible, for better readability.
1.2.1114.1.2. Specs¶
Short name |
Functions/ShouldUseConstants |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Examples |
|
Available in |