Build/update-changelog.php
Avoid using count() function in for loops. Open
Open
for ($i = 0; $i < count($title); $i++) {
$detailedTitle = $this->replaceCodeSections($title[$i]);
$pullRequest = null;
$detailedBody = preg_replace('/\n/', "\n> ", $body[$i]);
- Read upRead up
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
Each class must be in a namespace of at least one level (a top-level vendor name) Wontfix
Wontfix
class UpdateChangelog
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 24 and the first side effect is on line 260. Wontfix
Wontfix
<?php
- Exclude checks