[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        | -
I think you misunderstood me. testLoadClassMetadataThrowsExceptionIfNotAnArray and testDoNotModifyStateIfExceptionIsThrown both succeed if the constructor already throws an exception. this is why the test needs to be changed