Verified Commit 5da58a21 authored by quietone's avatar quietone
Browse files

Issue #3514226 by mstrelan, smustgrave: Add void return to functions in global namespace

parent 1f417d2f
Loading
Loading
Loading
Loading
Loading
+0 −1140

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ function _batch_finished() {
 * @see _batch_page()
 * @see drupal_register_shutdown_function()
 */
function _batch_shutdown() {
function _batch_shutdown(): void {
  if (($batch = batch_get()) && _batch_needs_update()) {
    \Drupal::service('batch.storage')->update($batch);
  }
+7 −7
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ function t($string, array $args = [], array $options = []) {
 * @param int $line
 *   (optional) The line number the error was raised at.
 */
function _drupal_error_handler($error_level, $message, $filename = NULL, $line = NULL) {
function _drupal_error_handler($error_level, $message, $filename = NULL, $line = NULL): void {
  require_once __DIR__ . '/errors.inc';
  _drupal_error_handler_real($error_level, $message, $filename, $line);
}
@@ -114,7 +114,7 @@ function _drupal_error_handler($error_level, $message, $filename = NULL, $line =
 * @param \Exception|\Throwable $exception
 *   The exception object that was thrown.
 */
function _drupal_exception_handler($exception) {
function _drupal_exception_handler($exception): void {
  require_once __DIR__ . '/errors.inc';

  try {
@@ -135,7 +135,7 @@ function _drupal_exception_handler($exception) {
 * @param \Exception|\Throwable $exception2
 *   The second exception object that was thrown.
 */
function _drupal_exception_handler_additional($exception, $exception2) {
function _drupal_exception_handler_additional($exception, $exception2): void {
  // Another uncaught exception was thrown while handling the first one.
  // If we are displaying errors, then do so with no possibility of a further
  // uncaught exception being thrown.
@@ -262,7 +262,7 @@ function drupal_generate_test_ua($prefix) {
 *
 * @see _drupal_maintenance_theme()
 */
function drupal_maintenance_theme() {
function drupal_maintenance_theme(): void {
  require_once __DIR__ . '/theme.maintenance.inc';
  _drupal_maintenance_theme();
}
@@ -425,7 +425,7 @@ function &drupal_static($name, $default_value = NULL, $reset = FALSE) {
 *   Resetting all variables should only be used, for example, for running
 *   unit tests with a clean environment.
 */
function drupal_static_reset($name = NULL) {
function drupal_static_reset($name = NULL): void {
  drupal_static($name, NULL, TRUE);
}

@@ -465,7 +465,7 @@ function &drupal_register_shutdown_function($callback = NULL, ...$args) {
/**
 * Executes registered shutdown functions.
 */
function _drupal_shutdown_function() {
function _drupal_shutdown_function(): void {
  $callbacks = &drupal_register_shutdown_function();

  // Set the CWD to DRUPAL_ROOT as it is not guaranteed to be the same as it
@@ -495,7 +495,7 @@ function _drupal_shutdown_function() {
 *
 * @see _drupal_shutdown_function()
 */
function _drupal_shutdown_function_handle_exception($exception) {
function _drupal_shutdown_function_handle_exception($exception): void {
  // If using PHP-FPM then fastcgi_finish_request() will have been fired
  // preventing further output to the browser.
  if (!function_exists('fastcgi_finish_request')) {
+2 −2
Original line number Diff line number Diff line
@@ -257,7 +257,7 @@ function base_path() {
 *
 * @see MenuForm::BuildOverviewForm()
 */
function drupal_attach_tabledrag(&$element, array $options) {
function drupal_attach_tabledrag(&$element, array $options): void {
  // Add default values to elements.
  $options = $options + [
    'subgroup' => NULL,
@@ -411,7 +411,7 @@ function show(&$element) {
 * @todo Add a global lock to ensure that caches are not primed in concurrent
 *   requests.
 */
function drupal_flush_all_caches($kernel = NULL) {
function drupal_flush_all_caches($kernel = NULL): void {
  // This is executed based on old/previously known information if $kernel is
  // not passed in, which is sufficient, since new extensions cannot have any
  // primed caches yet.
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ function drupal_error_levels(): array {
 * @param int $line
 *   The line number the error was raised at.
 */
function _drupal_error_handler_real($error_level, $message, $filename, $line) {
function _drupal_error_handler_real($error_level, $message, $filename, $line): void {
  if ($error_level & error_reporting()) {
    $types = drupal_error_levels();
    [$severity_msg, $severity_level] = $types[$error_level];
@@ -145,7 +145,7 @@ function error_displayable($error = NULL) {
 *   - A recoverable fatal error, which is a fatal error.
 *   Non-recoverable fatal errors cannot be logged by Drupal.
 */
function _drupal_log_error($error, $fatal = FALSE) {
function _drupal_log_error($error, $fatal = FALSE): void {
  $is_installer = InstallerKernel::installationAttempted() && \Drupal::hasContainer();

  // Backtrace, exception and 'severity_level' are not valid replacement values
@@ -353,7 +353,7 @@ function _drupal_get_error_level() {
 * @param int $line
 *   The line number in file that emitted the error.
 */
function _drupal_error_header($message, $type, $function, $file, $line) {
function _drupal_error_header($message, $type, $function, $file, $line): void {
  // $number does not use drupal_static as it should not be reset
  // as it uniquely identifies each PHP error.
  static $number = 0;
Loading