Convert a few call_user_func*() calls to native PHP syntax
authorMax Semenik <maxsem.wiki@gmail.com>
Fri, 8 Mar 2019 03:25:40 +0000 (19:25 -0800)
committerMax Semenik <maxsem.wiki@gmail.com>
Fri, 8 Mar 2019 03:25:40 +0000 (19:25 -0800)
Change-Id: I54d94f4369eb4fa0b0ebe892a1d6cc57b2bdb1f9

includes/TemplateParser.php
includes/WebResponse.php
includes/filerepo/file/File.php
includes/htmlform/fields/HTMLInfoField.php
includes/registration/ExtensionRegistry.php

index 75494b1..11a8e85 100644 (file)
@@ -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 );
        }
 }
index 9396a41..45cc7df 100644 (file)
@@ -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 ];
                                }
                        }
index 923484a..c3b5199 100644 (file)
@@ -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;
                }
index c0dbf50..b4aab4a 100644 (file)
@@ -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;
        }
index 88d9fd3..e3df499 100644 (file)
@@ -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] );
                }
        }