On the optimal synthesis of phase-only reconfigurable antenna arrays