Transition metal phosphide electrocatalysts for use in electrochemical and photoelectrochemical water splitting