Nonlinear phase-shift compensation method and apparatus