The European Court of Justice has said restrictions imposed by the Spanish government on the building of hypermarkets in Catalonia are illegal, a ruling that could have implications for restrictive planning processes throughout Europe.