  A measurement of the phase difference between the short- and long-distance
contributions to the $B^{+}\to K^{+}\mu^{+}\mu^{-}$ decay is performed by
analysing the dimuon mass distribution. The analysis is based on $pp$ collision
data corresponding to an integrated luminosity of 3 $\rm fb^{-1}$ collected by
the LHCb experiment in 2011 and 2012. The long-distance contribution to the
$B^{+}\to K^{+}\mu^{+}\mu^{-}$ decay is modelled as a sum of relativistic
Breit--Wigner amplitudes representing different vector meson resonances
decaying to muon pairs, each with their own magnitude and phase. The measured
phases of the $J/\psi$ and $\psi(2S)$ resonances are such that the interference
with the short-distance component in dimuon mass regions far from their pole
masses is small. In addition, constraints are placed on the Wilson
coefficients, $\mathcal{C}_{9}$ and $\mathcal{C}_{10}$, and the branching
fraction of the short-distance component is measured.
