The judge ruled that the law did not violate collective-bargaining rights