[Validator] Fixed: The state of the XML/YAML loaders was changed even if an exception was thrown upon loading

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12158
| License       | MIT
| Doc PR        | -
IMO explicit documentation is always preferrable over inheritdoc (from the API doc user POV). The situation is just that most of us (and I'm the first) are too lazy to write documentation most of the time.