Could Brexit negatively affect PhD students in the UK who are EU nationals?
Update on 2016-06-28: The UK Government has put out an official statement on this issue.
The short answer is "We don't know yet, but for a PhD program likely not."
The terms of Brexit have not been negotiated. They will may start to be negotiated if and after a vote to leave wins the referendum. (So that's the "we don't know".) On the other hand, it will be at least two years after the vote before the actual British exit from the EU (presumably to negotiate and to allow a graceful transition). If you are starting a 3-year PhD program this fall, there's a good chance that the negotiations will not have concluded fast enough to directly affect your research.
Source: the BBC writes
If the UK left the EU would UK citizens need special permits to work in the EU?
Lots of people asked about this. A lot would depend on the kind of deal the UK agreed with the EU after exit. If it remained within the single market, it would almost certainly retain free movement rights allowing UK citizens to work in the EU and vice versa. If the government opted to impose work permit restrictions, as UKIP wants, then other countries could reciprocate, meaning Britons would have to apply for visas to work.
What about EU nationals who want to work in the UK?
As explained in the answer above, it would depend on whether the UK government decided to introduce a work permit system of the kind that currently applies to non-EU citizens, limiting entry to skilled workers in professions where there are shortages.
and
How long will it take for Britain to leave the EU?
This was a question asked by many people. The minimum period after a vote to leave would be two years. During that time Britain would continue to abide by EU treaties and laws, but not take part in any decision-making, as it negotiated a withdrawal agreement and the terms of its relationship with the now 27 nation bloc. In practice it may take longer than two years, depending on how the negotiations go.
I was a funded PhD student from Russia in the 90s, before the EU existed. There are no issues as long as you have paperwork in order. I haven't had any problems at all.
The way it works is that British immigration will typically give you a "leave to remain" for 3 years when you enter the country. This allows you to come in and out of the country at any time, open a bank account, phone service, etc. I think you even get the NHS.
If your program takes longer (and again, you will have to supply paperwork) you may have to extend your leave to remain.
You do have to get a visa, which takes a couple of months. Apply at the British Consulate in Italy with all paperwork. Your visa will get exchanged for the "leave to remain" and a stamp in your passport with the expiration date; until that date you are, basically, British.
Even if British people opt for Brexit, it will take time. According to Refs. [1] and [2], it will take years for the Brexit to actually happen. I'm pretty sure you have plenty of time to arrange everything.
But just in case, I would get a signed contract mentioning the funding/salary from the university if you don't already have one.
[1] http://www.bbc.com/news/uk-politics-eu-referendum-35921610 [2] https://www.rt.com/uk/346505-brexit-how-long-leave/
Edit: Added additional reference.