Heat olive oil in a large overnproof skillet. Add garlic cloves and red pepper flakes and cook just until garlic is fragrant, about 1 minute.
Add the chopped tomato and the rosemary sprig and cook 2 minutes, stirring gently.
Add the cannellini beans and cook, partially smashing 1/4 of the beans with a spoon, for 5 minutes.
Remove the rosemary. Stir in 1/2 cup of chicken stock (or water) and chopped parsley (optional), and season with salt and pepper. Stir and evenly distribute the beans in skillet.
Sprinkle parmesan cheese on top and broil until cheese is golden, just a couple of minutes.