[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        | -
This phpdoc does not add any value:

- every PHP developer should know that ``__construct`` is called when creating a new instance (otherwise they are already in trouble when using Symfony)
- the type of the param is already documented by the typehint, so there is no new info here