Projects are built from the start to use the Media module and reference entities instead of files directly. That is how Entity Browser can help.
Here is how it's usually done:
More useful resouces:
This error is often caused by a "stale" autoloader file.
The first and most effective step would be to call
from inside your drupal installation folder (presumably /var/www/sites/drupalroot/) in order to force an updating of the autoloader file in your vendor folder. Try clearing the composer caches as well in combination with this ...
Here are some pointers that might help:
Run drush cr to clear cache and see if the error persists.
Enable error backtraces from the Config > Development > Logging & Errors page to see if you get more info in the error message about where the class is being redeclared.
Search your project for the name MyFormatter and see if you find anything ...