Phase-amplitude formalism for ultranarrow shape resonances