Context: The main legacy of the Revolt of the Barretinas was an enduring anti-French sentiment in the Catalan leadership and intelligentsia.  This would become relevant a decade later in 1700, when King Charles II died without a son.  Charles' death triggered the War of the Spanish Succession.  The two claimants were the French Philip, Duke of Anjou and the Austrian Emperor Leopold I.  The Spanish government chose Philip; French King Louis XIV, Philip's grandfather, naturally supported his grandson as well.  The Catalan upper classes, still distrustful of France from its efforts to stir the peasantry against them in 1689, had no love for Philip.  He was "a king chosen by Castilians."  In 1702, the cortes voted to recognize Leopold as king, and full-scale rebellion against Philip began in 1705 with the arrival of supporting Austrian troops.  The war would continue for nine more years, until the Siege of Barcelona in 1714 when the last remaining Catalan supporters of Leopold were defeated by the combined Franco-Castilian army.  The Nueva Planta decrees, issued by Philip from 1707-1714, ended the nominal split between Castile and Aragon and eliminated the traditional autonomy Aragon had kept.  Castilian law and institutions were mandated throughout Spain.

Question: Who declared Philip to be king

Answer:
The Spanish government