Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youwe/Global/Common standard conflicts with Magento Coding standards #6

Closed
boldhedgehog opened this issue Jan 16, 2023 · 2 comments · Fixed by #9 · May be fixed by magento/magento-coding-standard#416
Closed

Youwe/Global/Common standard conflicts with Magento Coding standards #6

boldhedgehog opened this issue Jan 16, 2023 · 2 comments · Fixed by #9 · May be fixed by magento/magento-coding-standard#416

Comments

@boldhedgehog
Copy link

boldhedgehog commented Jan 16, 2023

Youwe Common/Global ruleset is based on PSR-12, and Magento's https://github.com/magento/magento-coding-standard ruleset is still based on PSR2: https://github.com/magento/magento-coding-standard/blob/develop/Magento2/ruleset.xml
There are conflicting rules in PSR2 and PSR12:

  • PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine
  • PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace

A code like this cannot properly formatted to be valid for both rules:

if ($qty->getSku() != $orderItem->getSku() ||
    $qtyCount === 0 ||
    isset($data['qtys'][$orderItem->getItemId()]) ||
    $orderItem->getQtyRefunded() > 0
) {
    continue;
}

I would suggest to suppress PSR-12 rules and rely on Magento's ruleset.

UPD: Magento's coding standard seem to follow the PSR-2 rule:

if ($this->isCanceled() ||
            $this->isPaymentReview() ||
            $state === self::STATE_COMPLETE ||
            $state === self::STATE_CLOSED
        ) {
            return false;
        }
@fredden
Copy link

fredden commented Jan 16, 2023

Will magento/magento-coding-standard#416 fix this?

@fredden
Copy link

fredden commented Mar 15, 2023

This has been fixed in version 2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants