Is there a code that specifies the clearance required from the door to the front of the toilet? When our water closet door opens, at the smallest point, there is only 4.5 inches clearance. You could not open the door if someone were sitting on the toilet.
Why would you want to? LOL There are clearance requirements for the front of the toilet (21 to 24 inches to opposite wall)but as long as it clears the door swing, it's okay. Of course, that is assuming that it is not a bath that falls under Title 24 ADA handy capped rules.
I've seen homeowner remodels where the toilet blocked opening the glass shower door from opening more than half way. This is an actual safety violation that I wrote up. The door actually hit the toilet.