diff --git a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php index d3c7b08ecc..95f3b96e23 100644 --- a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php +++ b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php @@ -85,7 +85,7 @@ protected function formatPlural($count, $singular, $plural, array $args = [], ar * * @see \Drupal\Core\StringTranslation\TranslationInterface::formatSize() */ - protected function formatSize($size, $langcode = NULL) { + protected function formatSize(int $size, string $langcode = NULL) { return $this->getStringTranslation()->formatSize($size, $langcode); } diff --git a/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php b/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php index 63b0f87f69..05d0cc60b3 100644 --- a/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php +++ b/core/lib/Drupal/Core/StringTranslation/TranslationInterface.php @@ -128,6 +128,6 @@ public function formatPlural($count, $singular, $plural, array $args = [], array * @return \Drupal\Core\StringTranslation\TranslatableMarkup|\Drupal\Core\StringTranslation\PluralTranslatableMarkup * A translated string representation of the size. */ - public function formatSize($size, $langcode = NULL); + public function formatSize(int $size, string $langcode = NULL); } diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php index b5e7841d4e..84c0fc9ab2 100644 --- a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php +++ b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php @@ -179,7 +179,9 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#type' => 'textfield', '#title' => t('Maximum upload size'), '#default_value' => $settings['max_filesize'], - '#description' => t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit %limit).', ['%limit' => $this->formatSize(Environment::getUploadMaxSize())]), + '#description' => t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit %limit).', [ + '%limit' => $this->formatSize(Environment::getUploadMaxSize()), + ]), '#size' => 10, '#element_validate' => [[static::class, 'validateMaxFilesize']], '#weight' => 5,