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
This commit is contained in:
Tyler Anthony Romeo 2013-03-14 22:09:14 -04:00 committed by Alex Monk
parent 331bcf6ac9
commit 3b7c4f692e
3 changed files with 13 additions and 13 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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 {