Capacitor-current-feedback active damping method is commonly used in LCL-filtered grid-connected inverters, which attenuates the resonance peak by emulating a virtual resistor in parallel with the filter capacitor. Taking the digital control delay into account, the emulation component becomes frequency-dependent, and it will turn negative when the filter resonance frequency becomes higher than one-sixth of the sampling frequency, resulting in the inconsistent stability requirement. Due to the variation of grid impedance, the filter resonance frequency will vary in a wide range, and the inconsistent stability requirement may occur, which will pose a challenge to the inverter stability. In this paper, the stability of digitally controlled LCL-filtered inverter is studied first, and a phase lag compensator is introduced to ensure the stability requirement keeps consistent even if the filter resonance frequency reaches the Nyquist frequency. Thus the stability-robustness of the inverter to the grid impedance variation is improved. Finally, the validation of the proposed compensation method is verified by simulation and experimental results.