lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php
Avoid using CrEOF\Spatial\PHP\Types\count() function in for loops. Open
Open
for ($i = 0; $i < count($this->points); $i++) {
$points[] = $this->getPoint($i);
}
- Read upRead up
- Create a ticketCreate a ticket
- 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++) {
// ...
}
}
}