The concept that illegals can be residents of a state is logically inconsistent. If I break into your house, is that my residence?
If you rent or own a home which you reside in as your primary residence for a period of time greater than some number of months then by definition you are a resident of the state. That's how state law defines it. It makes no demarcation if you are in the country legally or not in the definition of residency.