This question is inspired by on this question but is focused on the sanctuary spell instead of the rage feature.
The last line of the Sanctuary spell is -
If the warded creature makes an attack or casts a spell that affects an enemy creature, this spell ends.
I am slightly doubtful of the split-up of this sentence, does it mean any attack (thus even attacking an object like a door could end the spell) or only attacks against creatures end the spell ?
On a second note if the target of Sanctuary attacks an illusion does it count as attacking/affecting an enemy creature ?