diff --git a/core/includes/batch.inc b/core/includes/batch.inc index af7987fd8fe02da6d45e775a240e7822c222e67b..ebee3eb35cd79d9e373449d7aa7386e1f619e7c4 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -360,9 +360,9 @@ function _batch_process() { '@total' => $total, '@current' => floor($current), '@percentage' => $percentage, - '@elapsed' => \Drupal::service('date.formatter')->formatInterval($elapsed / 1000), + '@elapsed' => \Drupal::service('date.formatter')->formatInterval((int) ($elapsed / 1000)), // If possible, estimate remaining processing time. - '@estimate' => ($current > 0) ? \Drupal::service('date.formatter')->formatInterval(($elapsed * ($total - $current) / $current) / 1000) : '-', + '@estimate' => ($current > 0) ? \Drupal::service('date.formatter')->formatInterval((int) (($elapsed * ($total - $current) / $current) / 1000)) : '-', ]; $message = strtr($progress_message, $values); @@ -453,7 +453,7 @@ function _batch_finished() { if (is_callable($batch_set['finished'])) { $queue = _batch_queue($batch_set); $operations = $queue->getAllItems(); - $batch_set_result = call_user_func_array($batch_set['finished'], [$batch_set['success'], $batch_set['results'], $operations, \Drupal::service('date.formatter')->formatInterval($batch_set['elapsed'] / 1000)]); + $batch_set_result = call_user_func_array($batch_set['finished'], [$batch_set['success'], $batch_set['results'], $operations, \Drupal::service('date.formatter')->formatInterval((int) ($batch_set['elapsed'] / 1000))]); // If a batch 'finished' callback requested a redirect after the batch // is complete, save that for later use. If more than one batch set // returned a redirect, the last one is used. diff --git a/core/modules/views/src/Plugin/views/field/TimeInterval.php b/core/modules/views/src/Plugin/views/field/TimeInterval.php index 79cd190605a7811ebb6de76b2f846d0be01688cb..77924234d1cebf624f1ff4476cac7681f7240e8a 100644 --- a/core/modules/views/src/Plugin/views/field/TimeInterval.php +++ b/core/modules/views/src/Plugin/views/field/TimeInterval.php @@ -82,7 +82,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { */ public function render(ResultRow $values) { $value = $values->{$this->field_alias}; - return $this->dateFormatter->formatInterval($value, isset($this->options['granularity']) ? $this->options['granularity'] : 2); + return $this->dateFormatter->formatInterval((int) $value, isset($this->options['granularity']) ? $this->options['granularity'] : 2); } } diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 40ed2b3f2f4020448f0d6aadcb760158fad0252e..2163902ba14804c4cb657a98ad3aa2319ed658ab 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -1311,7 +1311,7 @@ function simpletest_script_reporter_write_xml_results() { function simpletest_script_reporter_timer_stop() { echo "\n"; $end = Timer::stop('run-tests'); - echo "Test run duration: " . \Drupal::service('date.formatter')->formatInterval($end['time'] / 1000); + echo "Test run duration: " . \Drupal::service('date.formatter')->formatInterval((int) ($end['time'] / 1000)); echo "\n\n"; }