From: Tyler Anthony Romeo Date: Fri, 15 Mar 2013 02:09:14 +0000 (-0400) Subject: Removed Closure type hints where not needed. X-Git-Tag: 1.31.0-rc.0~19633 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=3b7c4f692e099491f91a8fa94f408291f620d43d;p=lhc%2Fweb%2Fwiklou.git Removed Closure type hints where not needed. Closures are not the only types of callable objects in PHP. Specifically, any string referencing a valid function, any object with a __call(), or any class with a __callStatic() can all be called. Therefore, removed type hinting for Closures in places where a callable is expected. (Unfortunately, the callable type-hint only comes in PHP 5.4.) Change-Id: I6bff7e4a95716ef63aa7e07d3d9fef6d20eb65a6 --- diff --git a/includes/MappedIterator.php b/includes/MappedIterator.php index b4376f44c7..14495f2f06 100644 --- a/includes/MappedIterator.php +++ b/includes/MappedIterator.php @@ -29,7 +29,7 @@ class MappedIterator implements Iterator { /** @var Iterator */ protected $baseIterator; - /** @var Closure */ + /** @var callable */ protected $vCallback; /** @@ -39,10 +39,10 @@ class MappedIterator implements Iterator { * The keys of the base iterator are reused verbatim. * * @param Iterator|Array $iter - * @param Closure $vCallback + * @param callable $vCallback * @throws MWException */ - public function __construct( $iter, Closure $vCallback ) { + public function __construct( $iter, $vCallback ) { if ( is_array( $iter ) ) { $this->baseIterator = new ArrayIterator( $iter ); } elseif ( $iter instanceof Iterator ) { @@ -51,7 +51,7 @@ class MappedIterator implements Iterator { throw new MWException( "Invalid base iterator provided." ); } $this->vCallback = $vCallback; - } + } /** * @return void diff --git a/includes/ScopedCallback.php b/includes/ScopedCallback.php index 8ecd87471a..fa88c0ee4f 100644 --- a/includes/ScopedCallback.php +++ b/includes/ScopedCallback.php @@ -26,13 +26,13 @@ * @since 1.21 */ class ScopedCallback { - /** @var Closure */ + /** @var callable */ protected $callback; /** - * @param $callback Closure + * @param callable $callback */ - public function __construct( Closure $callback ) { + public function __construct( $callback ) { $this->callback = $callback; } diff --git a/includes/db/Database.php b/includes/db/Database.php index 09866dca5d..799e1682e9 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -229,9 +229,9 @@ abstract class DatabaseBase implements DatabaseType { protected $mConn = null; protected $mOpened = false; - /** @var array of Closure */ + /** @var callable[] */ protected $mTrxIdleCallbacks = array(); - /** @var array of Closure */ + /** @var callable[] */ protected $mTrxPreCommitCallbacks = array(); protected $mTablePrefix; @@ -2966,10 +2966,10 @@ abstract class DatabaseBase implements DatabaseType { * after the database is updated so that the jobs will see the data when they actually run. * It can also be used for updates that easily cause deadlocks if locks are held too long. * - * @param Closure $callback + * @param callable $callback * @since 1.20 */ - final public function onTransactionIdle( Closure $callback ) { + final public function onTransactionIdle( $callback ) { $this->mTrxIdleCallbacks[] = $callback; if ( !$this->mTrxLevel ) { $this->runOnTransactionIdleCallbacks(); @@ -2984,10 +2984,10 @@ abstract class DatabaseBase implements DatabaseType { * This is useful for updates that easily cause deadlocks if locks are held too long * but where atomicity is strongly desired for these updates and some related updates. * - * @param Closure $callback + * @param callable $callback * @since 1.22 */ - final public function onTransactionPreCommitOrIdle( Closure $callback ) { + final public function onTransactionPreCommitOrIdle( $callback ) { if ( $this->mTrxLevel ) { $this->mTrxPreCommitCallbacks[] = $callback; } else {