[FrameworkBundle] Optimize validator registration
minor #13111 [FrameworkBundle] Optimize validator registration (dunglas)

This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Optimize validator registration

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Optimize validator registration (avoid an unneeded loop and access to the Reflection API).

Commits
-------

9c5b9e1 [FrameworkBundle] Optimize validator registration