2016-06-13 94 views
0

我試圖讓我的PHP代碼PSR-1 PSR-2兼容不要我收到一些奇怪的錯誤,其實我不理解它到底要我解決:(PHP代碼嗅探器驗證問題

什麼問題-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')); 
}   

問題-2

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

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

任何線索的人?

其他代碼補丁都出現同樣的錯誤

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; 
    } 

謝謝!

回答

0

Issue1:

  • &&應該是在下一行
  • (和關閉)應在單行參數在同一行上市:)
不能

格式source here,e​​xternal url:pastebin link

問題2: {應在同一行

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

都能跟得上它不工作的第二個問題,雖然它的工作對第一個問題:)看到我的編輯看到代碼補丁我正在havng麻煩 –

+0

你有「標籤」代碼之前。刪除最後3行中的前4個空格 –

+0

您需要在打開的大括號之前留出空格,並且該空格必須與定義位於同一行。將--report = diff添加到PHPCS,它會告訴您如何更改代碼來修復所有這些錯誤。 –