Replace use of &$this
[lhc/web/wiklou.git] / includes / deferred / LinksUpdate.php
index 229a9a2..464c908 100644 (file)
@@ -154,7 +154,9 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
 
                $this->mRecursive = $recursive;
 
-               Hooks::run( 'LinksUpdateConstructed', [ &$this ] );
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $linksUpdate = $this;
+               Hooks::run( 'LinksUpdateConstructed', [ &$linksUpdate ] );
        }
 
        /**
@@ -169,7 +171,9 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                        $scopedLock = self::acquirePageLock( $this->getDB(), $this->mId );
                }
 
-               Hooks::run( 'LinksUpdate', [ &$this ] );
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $linksUpdate = $this;
+               Hooks::run( 'LinksUpdate', [ &$linksUpdate ] );
                $this->doIncrementalUpdate();
 
                // Commit and release the lock (if set)
@@ -177,7 +181,9 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                // Run post-commit hooks without DBO_TRX
                $this->getDB()->onTransactionIdle(
                        function () {
-                               Hooks::run( 'LinksUpdateComplete', [ &$this, $this->ticket ] );
+                               // Avoid PHP 7.1 warning from passing $this by reference
+                               $linksUpdate = $this;
+                               Hooks::run( 'LinksUpdateComplete', [ &$linksUpdate, $this->ticket ] );
                        },
                        __METHOD__
                );