magento / marketplace-eqp

Magento 1.x Coding Standard
http://docs.magento.com/marketplace/user_guide/Resources/pdf/Extension_Quality_Program_Overview.pdf
MIT License
224 stars 68 forks source link

False positives with calling count() inside loop #113

Open mwgamble opened 5 years ago

mwgamble commented 5 years ago

The loop performance error MEQP1.Performance.Loop.ArraySize should not trigger when the variable that count() is being called on is declared inside that same loop. For example:

foreach ($productIds as $productId) {
    $images = getImages($productId);
    echo count($images) . "\n";
}

In this case, it isn't possible to call count() outside the loop, and therefore the warning is invalid.