How to use dependency injection to apply a class static method? I'm building a custom form (extending ConfigFormBase) and using static method File::load($fid). How to use dependency injection to call this method?
Thank you!
In __construct() you can implement like this:

use Drupal\Core\Entity\EntityTypeManagerInterface;

public function __construct(EntityTypeManagerInterface $entity_type_manager) {
    $this-&gt;entityTypeManager = $entity_type_manager;
}


and create() method

public static function create(ContainerInterface $container) {
    return new static(
      $container-&gt;get('entity_type.manager'),
    );
}


You can use this service to get the file storage:

$file_storage = $this-&gt;entityTypeManager()-&gt;getStorage('file');


and then load the file:

$file = $file_storage-&gt;load($fid);