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

A false positive: «Only dependency assignment operations are allowed in constructor» #77

Closed shochdoerfer closed 5 years ago

shochdoerfer commented 6 years ago

When running EQP against our Force Login module the warning "Only dependency assignment operations are allowed in constructor. No other operations are allowed." shows up for this piece of code:

/**
 * @param StrategyInterface[] $strategies
 */
public function __construct(array $strategies)
{
    foreach ($strategies as $identifier => $strategyEntry) {
        $this->strategies[$identifier] = $strategyEntry;
        $this->strategyNames[$identifier] = $strategyEntry->getName();
    }
}

I guess it might be quite hard to guess what constructor code is valid, but in that regard the warning does not make any sense to me.

lenaorobei commented 5 years ago

Closing this issue because this repo now contains sniffs for Magento 1.x code only. Please refer to magento/magento-coding-standard for Magento 2.x coding standard.

This rule was removed in magento/magento-coding-standard in order to eliminate false-positive findings.