The Supreme Court settled this in 1999 in a case specific to California.
“(District Judge Levi) concluded that the statute placed a ‘penalty on the decision of new residents to migrate to the State and be treated on an equal basis with existing residents’ Green v Anderson 811 F Supp. 516, 521 (Ed. Cal 1993) In his view, if the purpose of the measure was to deter migration by poor people into the State, it would be unconstitutional for that reason. And even if the purpose was only to conserve limited funds, the State had failed to explain why the entire burden of the saving should be imposed on new residents. … [In Shapiro] We squarely held that it was ‘constitutionally impermissible’ for a state to enact durational residency requirements for the purpose of inhibiting the migration by needy persons into the State. We further held that a classification that had the effect of imposing a penalty on the exercise of the right to travel violated the Equal Protection Clause unless shown to be necessary to promote a compelling governmental interest. …What is at issue in this case, then, is this third aspect of the right to travel – the right of the newly arrived citizen to the same privileges and immunities enjoyed by other citizens of the same state. That right is protected not only by the new arrival’s status as a state citizen but also by her status as a citizen of the United States. ”
Saenz v. Roe 526 U.S. 489 (1999) 134 F.3d 1400