Gas-phase cyclization processes of stabilized phosphorus ylides bearing a suitably substituted 2-aminophenyl group lead efficiently either to 3-substituted quinolines or benzo[c]carbazole and heterocyclic-fused analogues depending on the substituents present.