1.2.787. New Line Style¶
New lines may be written with the sequence n or with the constant PHP_EOL.
When one of those alternatives is used over 90% of the time, it is considered as standard : the remaining are reported.
n are only located when used alone, in “n” (including the double quotes). When n is used inside a double-quoted string, its replacement with PHP_EOL would be cumbersome : as such, they are ignored by this analyzer.
<?php
// This may be repeated over 10 times
$a = "PHP is a great language\n";
$a .= "\n";
// This only appears once in the code : this line is reported.
$b = $a.PHP_EOL.$c;
?>
1.2.787.1. Specs¶
Short name |
Structures/NewLineStyle |
Rulesets |
|
Exakat since |
0.9.8 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |