From b9cd789fce4e0723f14159aa13378b190490ac40 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 19 Apr 2014 08:43:31 +0200 Subject: [PATCH] docs: closure -> Closure; callback -> callable Changed closure to capital word Closure in doc and type hint, also changed callback in docs to callable Change-Id: I52c8e8f13d38a837052101c38b9986be780ca057 --- includes/Import.php | 28 +++++++++---------- includes/deferred/CallableUpdate.php | 2 +- includes/filebackend/FileBackendStore.php | 2 +- includes/objectcache/APCBagOStuff.php | 4 +-- includes/objectcache/BagOStuff.php | 14 +++++----- includes/objectcache/EmptyBagOStuff.php | 4 +-- includes/objectcache/MultiWriteBagOStuff.php | 6 ++-- includes/objectcache/SqlBagOStuff.php | 2 +- includes/objectcache/XCacheBagOStuff.php | 4 +-- includes/parser/Parser.php | 2 +- .../includes/libs/GenericArrayObjectTest.php | 2 +- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/includes/Import.php b/includes/Import.php index b18e25716a..6150ae194c 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -105,8 +105,8 @@ class WikiImporter { /** * Set a callback that displays notice messages * - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setNoticeCallback( $callback ) { return wfSetVar( $this->mNoticeCallback, $callback ); @@ -114,8 +114,8 @@ class WikiImporter { /** * Sets the action to perform as each new page in the stream is reached. - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setPageCallback( $callback ) { $previous = $this->mPageCallback; @@ -129,8 +129,8 @@ class WikiImporter { * with the original title form (in case it's been overridden into a * local namespace), and a count of revisions. * - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setPageOutCallback( $callback ) { $previous = $this->mPageOutCallback; @@ -140,8 +140,8 @@ class WikiImporter { /** * Sets the action to perform as each page revision is reached. - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setRevisionCallback( $callback ) { $previous = $this->mRevisionCallback; @@ -151,8 +151,8 @@ class WikiImporter { /** * Sets the action to perform as each file upload version is reached. - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setUploadCallback( $callback ) { $previous = $this->mUploadCallback; @@ -162,8 +162,8 @@ class WikiImporter { /** * Sets the action to perform as each log item reached. - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setLogItemCallback( $callback ) { $previous = $this->mLogItemCallback; @@ -173,8 +173,8 @@ class WikiImporter { /** * Sets the action to perform when site info is encountered - * @param $callback callback - * @return callback + * @param callable $callback + * @return callable */ public function setSiteInfoCallback( $callback ) { $previous = $this->mSiteInfoCallback; diff --git a/includes/deferred/CallableUpdate.php b/includes/deferred/CallableUpdate.php index f0569dde5c..808626d0f9 100644 --- a/includes/deferred/CallableUpdate.php +++ b/includes/deferred/CallableUpdate.php @@ -5,7 +5,7 @@ */ class MWCallableUpdate implements DeferrableUpdate { /** - * @var closure/callback + * @var Closure|callable */ private $callback; diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 2fd1bf66a7..368bf16c26 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -46,7 +46,7 @@ abstract class FileBackendStore extends FileBackend { /** @var array Map of container names to sharding config */ protected $shardViaHashLevels = array(); - /** @var callback Method to get the MIME type of files */ + /** @var callable Method to get the MIME type of files */ protected $mimeCallback; protected $maxFileSize = 4294967296; // integer bytes (4GiB) diff --git a/includes/objectcache/APCBagOStuff.php b/includes/objectcache/APCBagOStuff.php index f8741cfd35..4cbb32df82 100644 --- a/includes/objectcache/APCBagOStuff.php +++ b/includes/objectcache/APCBagOStuff.php @@ -89,12 +89,12 @@ class APCBagOStuff extends BagOStuff { /** * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Success */ - public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + public function merge( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { return $this->mergeViaLock( $key, $callback, $exptime, $attempts ); } diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 05d897f1fb..99f73aabe2 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -102,12 +102,12 @@ abstract class BagOStuff { * and takes the arguments: (this BagOStuff object, cache key, current value). * * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Success */ - public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + public function merge( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { return $this->mergeViaCas( $key, $callback, $exptime, $attempts ); } @@ -115,12 +115,12 @@ abstract class BagOStuff { * @see BagOStuff::merge() * * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Success */ - protected function mergeViaCas( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + protected function mergeViaCas( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { do { $casToken = null; // passed by reference $currentValue = $this->get( $key, $casToken ); // get the old value @@ -144,12 +144,12 @@ abstract class BagOStuff { * @see BagOStuff::merge() * * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Success */ - protected function mergeViaLock( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + protected function mergeViaLock( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { if ( !$this->lock( $key, 6 ) ) { return false; } @@ -218,7 +218,7 @@ abstract class BagOStuff { /** * Delete all objects expiring before a certain date. * @param string $date The reference date in MW format - * @param callback|bool $progressCallback Optional, a function which will be called + * @param callable|bool $progressCallback Optional, a function which will be called * regularly during long-running operations with the percentage progress * as the first parameter. * diff --git a/includes/objectcache/EmptyBagOStuff.php b/includes/objectcache/EmptyBagOStuff.php index 3f6f6c72cd..9595b83ce8 100644 --- a/includes/objectcache/EmptyBagOStuff.php +++ b/includes/objectcache/EmptyBagOStuff.php @@ -69,12 +69,12 @@ class EmptyBagOStuff extends BagOStuff { /** * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Success */ - public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + public function merge( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { return true; } } diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index a1290f80d2..c656bdd698 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -170,12 +170,12 @@ class MultiWriteBagOStuff extends BagOStuff { /** * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Success */ - public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + public function merge( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { return $this->doWrite( 'merge', $key, $callback, $exptime ); } @@ -211,7 +211,7 @@ class MultiWriteBagOStuff extends BagOStuff { * * Succeed if any of the child caches succeed. * @param string $date - * @param bool|callback $progressCallback + * @param bool|callable $progressCallback * @return bool */ public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) { diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 4a1e2c947b..8bf0c8144e 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -487,7 +487,7 @@ class SqlBagOStuff extends BagOStuff { /** * Delete objects from the database which expire before a certain date. * @param string $timestamp - * @param bool|callback $progressCallback + * @param bool|callable $progressCallback * @return bool */ public function deleteObjectsExpiringBefore( $timestamp, $progressCallback = false ) { diff --git a/includes/objectcache/XCacheBagOStuff.php b/includes/objectcache/XCacheBagOStuff.php index 078f6d4ae5..b12a40c7a4 100644 --- a/includes/objectcache/XCacheBagOStuff.php +++ b/includes/objectcache/XCacheBagOStuff.php @@ -98,12 +98,12 @@ class XCacheBagOStuff extends BagOStuff { * provide a way to perform CAS-like functionality. * * @param string $key - * @param closure $callback Callback method to be executed + * @param Closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure * @return bool Cuccess */ - public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { + public function merge( $key, Closure $callback, $exptime = 0, $attempts = 10 ) { return $this->mergeViaLock( $key, $callback, $exptime, $attempts ); } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 1a1ef3841d..68188843c5 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4973,7 +4973,7 @@ class Parser { * about the methods available in PPFrame and PPNode. * * @throws MWException - * @return string|callback The old callback function for this name, if any + * @return string|callable The old callback function for this name, if any */ public function setFunctionHook( $id, $callback, $flags = 0 ) { global $wgContLang; diff --git a/tests/phpunit/includes/libs/GenericArrayObjectTest.php b/tests/phpunit/includes/libs/GenericArrayObjectTest.php index e2ec47416c..806f5bfd55 100644 --- a/tests/phpunit/includes/libs/GenericArrayObjectTest.php +++ b/tests/phpunit/includes/libs/GenericArrayObjectTest.php @@ -170,7 +170,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { /** * @since 1.20 * - * @param callback $function + * @param callable $function * * @covers GenericArrayObject::getObjectType */ -- 2.20.1