return $this->__call( __FUNCTION__, func_get_args() );
}
- public function doAtomicSection( $fname, $callback ) {
+ public function doAtomicSection( $fname, callable $callback ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
}
}
- final public function doAtomicSection( $fname, $callback ) {
- if ( !is_callable( $callback ) ) {
- throw new UnexpectedValueException( "Invalid callback." );
- };
-
+ final public function doAtomicSection( $fname, callable $callback ) {
$this->startAtomic( $fname );
try {
call_user_func_array( $callback, [ $this, $fname ] );
* @throws UnexpectedValueException
* @since 1.27
*/
- public function doAtomicSection( $fname, $callback );
+ public function doAtomicSection( $fname, callable $callback );
/**
* Begin a transaction. If a transaction is already in progress,
* @return bool Success
* @throws InvalidArgumentException
*/
- public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
- if ( !is_callable( $callback ) ) {
- throw new InvalidArgumentException( "Got invalid callback." );
- }
-
+ public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
return $this->mergeViaLock( $key, $callback, $exptime, $attempts, $flags );
}
return true;
}
- public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
+ public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
return true; // faster
}
}
$this->fixExpiry( $exptime ) );
}
- public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
- if ( !is_callable( $callback ) ) {
- throw new Exception( "Got invalid callback." );
- }
-
+ public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
return $this->mergeViaCas( $key, $callback, $exptime, $attempts );
}
return $this->writeStore->unlock( $key );
}
- public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
+ public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
return $this->writeStore->merge( $key, $callback, $exptime, $attempts, $flags );
}
return true;
}
- public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
- if ( !is_callable( $callback ) ) {
- throw new Exception( "Got invalid callback." );
- }
-
+ public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
return $this->mergeViaCas( $key, $callback, $exptime, $attempts );
}
}
return $newValue;
}
- public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
- if ( !is_callable( $callback ) ) {
- throw new Exception( "Got invalid callback." );
- }
-
+ public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
$ok = $this->mergeViaCas( $key, $callback, $exptime, $attempts );
if ( ( $flags & self::WRITE_SYNC ) == self::WRITE_SYNC ) {
$ok = $ok && $this->waitForSlaves();