Php Code Sniffer validation issues

353 Views Asked by At

I am trying to make my php code psr-1 psr-2 compliant Don't i am getting some weird errors actually i am not understanding what exactly it want me to solve :(

Issue-1

Error: Opening parenthesis of a multi-line function call must be the last content on the line.

 if (Configuration::updateValue('AV_GTC_CT_GT_DG_CT', $AV_GTC_CT) &&
        Configuration::updateValue('AV_GTC_ST_CR_GP', $AV_GTC_ST) &&
        Configuration::updateValue('AV_GTC_SD_NN_EA_AR_CN_AT_CT', $AV_GTC_SD) &&
        Configuration::updateValue('AV_GTC_SD_NN_EA_AR_BK_CN', $AV_GTC_SD_NN_EA_AR_BK_CN) &&
        Configuration::updateValue('AV_GTC_SW_GT_TO_CR_AT_BN_AT_OR_AS_PE',
            $AV_GTC_SW_GT_TO_CR_AT_BN_AT_OR
        ) &&
        Configuration::updateValue('AV_GTC_CN_CE_FR_LG_CR_CN', $AV_GTC_CN)
    ) {
    $output .= $this->displayConfirmation($this->l('Settings updated'));
}          

Issue-2

Error:Expected "if (...) {\n"; found "if (...)\n {\n"

if (!$customer->isGuest())
                {
                    return false;
                }

Any Clue Guys?

Other code patches that are showing same errors

  if (!$customer->isGuest()){
    return false;
 }



if (empty($password)){
                        $password = Tools::passwdGen();
                    }
if (empty($id_customer)||empty($id_guest)){
        return false;
    }


    if (empty($id_guest) || empty($id_customer)){
        return false;
    }  

Thanks!

1

There are 1 best solutions below

3
On

Issue1:

  • && should be on the next line
  • open ( and close ) should be in the same line for single line argument listing :)

can't format source here, external url: pastebin link

Issue2: { should be on the same line

if (!$customer->isGuest()) {
    return false;
}