Quantum state of an ideal phase detector