Showing 42 of 42 total issues
Avoid using MikeBrant\RestClientLib\count() function in for loops. Open
Open
for ($i = 0; $i < count($data); $i++) {
$element = $data[$i];
curl_setopt($this->curlHandles[$i], CURLOPT_POSTFIELDS, $element);
}
- 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
Avoid using MikeBrant\RestClientLib\count() function in for loops. Open
Open
for ($i = 0; $i < count($actions); $i++) {
$url = $this->buildUrl($actions[$i]);
curl_setopt($this->curlHandles[$i], CURLOPT_URL, $url);
}
- 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++) {
// ...
}
}
}