Problem/Motivation
Currently file_validate takes and array of validators keyed by function name. We can use the syntax accepted by \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback to specify a class method or a service much like \Drupal\Core\Controller\ControllerResolver and \Drupal\Core\Render\Renderer::doCallback does.
Steps to reproduce
Proposed resolution
Add logic to look up file validators by class method or service definition and call doTrustedCallback() on them.
Comments
Comment #2
kim.pepperI think we are postponed on #2982949: Introduce CallableResolver to help standardise the DX and error handling for callbacks across various subsystems
Comment #3
kim.pepperComment #5
kim.pepperI think this issue is resolved by #3221793: Move file upload validation from file.module to constraint validators
Comment #6
kim.pepperOutdated by #3221793: Move file upload validation from file.module to constraint validators