How to fix Call to deprecated constant FILE_STATUS_PERMANENT: Deprecated

I had this error in a Drupal 9 envirronment: 

Call to deprecated constant FILE_STATUS_PERMANENT: Deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\file\FileInterface::STATUS_PERMANENT or
         \Drupal\file\FileInterface::setPermanent().

How to fix

Add a namespace:

use Drupal\file\FileInterface;

And change your code: 

-    $file = File::create(['uri' => $file_uri, 'status' => FILE_STATUS_PERMANENT]);
+    $file = File::create(['uri' => $file_uri, 'status' => FileInterface::STATUS_PERMANENT]);