I have a Whirlpool (sorry, guys) 50 gallon electric WH that's 24" in diameter. Installation instructions don't require any specific clearances. However, in a remarkable display of candor, they say "...the tank will leak after an extended period of time..." and recommend a drain pan be installed unless a leak won't bother anything. They require a drain pan 2" wider than the heater, so for this WH you'd need a closet at least 28" square, with a door at least 24" wide.
Other WHs may be tall & skinny rather than short and squatty, so I'd look around. Also, nobody is going to get excited about installing the thing in a cramped space.