2017-05-10 61 views
0

我已經從昨天開始尋找兩個代碼嗅探器錯誤的分辨率:代碼嗅探器錯誤到js代碼

62 | ERROR | [x] Expected 1 space after closing parenthesis; found 
    |  |  " options.keys = $.extend(\n 

這裏是我的代碼:

if (newOptions.keys) options.keys = $.extend(
    { 
    shift: 1, 
    ctrl: 'resize' }, 
    newOptions.keys 
); 

我想有眼外部人的解決這個,謝謝你的關注:)

+0

你混淆了它不使用花括號爲你,如果,我想?尤其是對於同一線條上的物體的花括號。 –

+0

「phpcs --standard = PSR2」告訴我,我必須跳上面的線( 看我的更新) 我只有一個錯誤,但我仍然沒有看到... – user7992606

回答

1

我不得不看到文件的其餘部分能夠生成和修復Expected 1 space after closing parenthesis錯誤,但如果你想格式IF的方式聲明PSR2很滿意,你可以這樣做:如果您使用的是標準,允許內嵌控制結構

if (newOptions.keys) { 
    options.keys = $.extend(
     { 
      shift: 1, 
      ctrl: 'resize' 
     }, 
     newOptions.keys 
    ); 
} 

,你可以忽略的PSR2錯誤,並使用此代碼相反:

if (newOptions.keys) options.keys = $.extend(
    { 
     shift: 1, 
     ctrl: 'resize' 
    }, 
    newOptions.keys 
);