Retrieval of phase information in neutron reflectometry