src/Filesystem/Pattern.php
Avoid using AmaTeam\Image\Projection\Filesystem\sizeof() function in while loops. Open
Open
while (sizeof($candidates) > 0) {
/** @var Chunk $chunk */
$chunk = array_shift($candidates);
if ($chunk->getType() !== Chunk::TYPE_EXACT_MATCH) {
break;
- 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++) {
// ...
}
}
}