This is terrible advice, the company will never give you a heads up if they are going to fire you. Do what's best for you. Keeping a good relationship with your current employer comes second.
The company doesn't care, but your manager and you team might. It is maintaining those relationships that works to your benefit in the future. Burning bridges just because you can is a pretty reliable way of limiting your future career prospects, at least in your local area. Word gets around.