Can I be a resident in a country with a company in another country?

#1

Hello there,
I am currently staying in Poland, and I’d like to stay for more than 6 months which would make me a resident of this country. I really don’t want to open a Polish company (I don’t know the language, there is an initial capital requirement, etc).
So my plan would be to open a limited company somewhere else in Europe first (for example Ireland), then apply for residency in Poland (I am a EU citizen so that’s no problem), and finally from what I understood I need to declare a ‘branch’ of my Irish company in Poland.
Does somebody here have some experience with that? Is that legal? Thanks!