diff --git a/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php b/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php index 5fecf2c618d3a80c738b0d99c0719bf1cff03640..312bc4f4c93a4c97e6bf043539989c552c52bf46 100644 --- a/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php +++ b/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Drupal\Core\Form\Exception; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -12,36 +14,36 @@ class BrokenPostRequestException extends BadRequestHttpException { /** * The maximum upload size. * - * @var string + * @var int */ - protected $size; + protected int $size; /** * Constructs a new BrokenPostRequestException. * - * @param string $max_upload_size - * The size of the maximum upload size. + * @param int $max_upload_size + * The size of the maximum upload size in bytes. * @param string $message * The internal exception message. - * @param \Exception $previous + * @param \Exception|null $previous * The previous exception. * @param int $code * The internal exception code. */ - public function __construct($max_upload_size, $message = '', \Exception $previous = NULL, $code = 0) { + public function __construct(int $max_upload_size, string $message = '', \Exception $previous = NULL, int $code = 0) { parent::__construct($message, $previous, $code); $this->size = $max_upload_size; } /** - * Returns the maximum upload size. + * Returns the maximum upload size in bytes. * - * @return string - * A translated string representation of the size of the file size limit - * based on the PHP upload_max_filesize and post_max_size. + * @return int + * The file size limit in bytes based on the PHP upload_max_filesize and + * post_max_size. */ - public function getSize() { + public function getSize(): int { return $this->size; } diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index d7c4bf9374f203b8e97a421b6e4c23eae001ffde..9fc959cf4c93db9d86d8544fe2cff2e1842bd7b1 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -1399,11 +1399,11 @@ protected function buttonWasClicked($element, FormStateInterface &$form_state) { /** * Wraps file_upload_max_size(). * - * @return string - * A translated string representation of the size of the file size limit - * based on the PHP upload_max_filesize and post_max_size. + * @return int + * The file size limit in bytes based on the PHP upload_max_filesize and + * post_max_size. */ - protected function getFileUploadMaxSize() { + protected function getFileUploadMaxSize(): int { return Environment::getUploadMaxSize(); }