Get rid of call_user_func(_array)(), part 3
[lhc/web/wiklou.git] / includes / libs / objectcache / MultiWriteBagOStuff.php
index 65f3a8a..edd5fbc 100644 (file)
@@ -20,6 +20,7 @@
  * @file
  * @ingroup Cache
  */
+use Wikimedia\ObjectFactory;
 
 /**
  * A cache class that replicates all writes to multiple child caches. Reads
@@ -171,7 +172,7 @@ class MultiWriteBagOStuff extends BagOStuff {
        /**
         * Apply a write method to the first $count backing caches
         *
-        * @param integer $count
+        * @param int $count
         * @param bool $asyncWrites
         * @param string $method
         * @param mixed $args,...
@@ -194,16 +195,15 @@ class MultiWriteBagOStuff extends BagOStuff {
 
                        if ( $i == 0 || !$asyncWrites ) {
                                // First store or in sync mode: write now and get result
-                               if ( !call_user_func_array( [ $cache, $method ], $args ) ) {
+                               if ( !$cache->$method( ...$args ) ) {
                                        $ret = false;
                                }
                        } else {
                                // Secondary write in async mode: do not block this HTTP request
                                $logger = $this->logger;
-                               call_user_func(
-                                       $this->asyncHandler,
+                               ( $this->asyncHandler )(
                                        function () use ( $cache, $method, $args, $logger ) {
-                                               if ( !call_user_func_array( [ $cache, $method ], $args ) ) {
+                                               if ( !$cache->$method( ...$args ) ) {
                                                        $logger->warning( "Async $method op failed" );
                                                }
                                        }
@@ -233,11 +233,11 @@ class MultiWriteBagOStuff extends BagOStuff {
                return $ret;
        }
 
-       public function makeKey() {
-               return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() );
+       public function makeKey( $class, $component = null ) {
+               return $this->caches[0]->makeKey( ...func_get_args() );
        }
 
-       public function makeGlobalKey() {
-               return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() );
+       public function makeGlobalKey( $class, $component = null ) {
+               return $this->caches[0]->makeGlobalKey( ...func_get_args() );
        }
 }