From 61c539126f88517c8c2f3aa5bbf2b254deab9c76 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Thu, 7 Mar 2019 19:25:40 -0800 Subject: [PATCH] Convert a few call_user_func*() calls to native PHP syntax Change-Id: I54d94f4369eb4fa0b0ebe892a1d6cc57b2bdb1f9 --- includes/TemplateParser.php | 2 +- includes/WebResponse.php | 2 +- includes/filerepo/file/File.php | 2 +- includes/htmlform/fields/HTMLInfoField.php | 2 +- includes/registration/ExtensionRegistry.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php index 75494b1ed8..11a8e85656 100644 --- a/includes/TemplateParser.php +++ b/includes/TemplateParser.php @@ -220,6 +220,6 @@ class TemplateParser { */ public function processTemplate( $templateName, $args, array $scopes = [] ) { $template = $this->getTemplate( $templateName ); - return call_user_func( $template, $args, $scopes ); + return $template( $args, $scopes ); } } diff --git a/includes/WebResponse.php b/includes/WebResponse.php index 9396a41a76..45cc7df7a6 100644 --- a/includes/WebResponse.php +++ b/includes/WebResponse.php @@ -205,7 +205,7 @@ class WebResponse { wfDebugLog( 'cookie', 'already set ' . $func . ': "' . implode( '", "', $data ) . '"' ); } else { wfDebugLog( 'cookie', $func . ': "' . implode( '", "', $data ) . '"' ); - if ( call_user_func_array( $func, array_values( $data ) ) ) { + if ( $func( ...array_values( $data ) ) ) { self::$setCookies[$key] = $deleting ? null : [ $func, $data ]; } } diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 923484add8..c3b519944c 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -207,7 +207,7 @@ abstract class File implements IDBAccessObject { if ( !is_callable( $function ) ) { return null; } else { - $this->$name = call_user_func( $function ); + $this->$name = $function(); return $this->$name; } diff --git a/includes/htmlform/fields/HTMLInfoField.php b/includes/htmlform/fields/HTMLInfoField.php index c0dbf500d2..b4aab4a020 100644 --- a/includes/htmlform/fields/HTMLInfoField.php +++ b/includes/htmlform/fields/HTMLInfoField.php @@ -22,7 +22,7 @@ class HTMLInfoField extends HTMLFormField { public function getDefault() { $default = parent::getDefault(); if ( $default instanceof Closure ) { - $default = call_user_func( $default, $this->mParams ); + $default = $default( $this->mParams ); } return $default; } diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index 88d9fd3f99..e3df499987 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -374,7 +374,7 @@ class ExtensionRegistry { } throw new UnexpectedValueException( "callback '$cb' is not callable" ); } - call_user_func( $cb, $info['credits'][$name] ); + $cb( $info['credits'][$name] ); } } -- 2.20.1