list( $callback, $flags ) = $this->mFunctionHooks[$function];
- # Workaround for PHP bug 35229 and similar
- if ( !is_callable( $callback ) ) {
- throw new MWException( "Tag hook for $function is not callable\n" );
- }
-
// Avoid PHP 7.1 warning from passing $this by reference
$parser = $this;
}
if ( isset( $this->mTagHooks[$name] ) ) {
- # Workaround for PHP bug 35229 and similar
- if ( !is_callable( $this->mTagHooks[$name] ) ) {
- throw new MWException( "Tag hook for $name is not callable\n" );
- }
$output = call_user_func_array( $this->mTagHooks[$name],
[ $content, $attributes, $this, $frame ] );
} elseif ( isset( $this->mFunctionTagHooks[$name] ) ) {
list( $callback, ) = $this->mFunctionTagHooks[$name];
- if ( !is_callable( $callback ) ) {
- throw new MWException( "Tag hook for $name is not callable\n" );
- }
// Avoid PHP 7.1 warning from passing $this by reference
$parser = $this;
* @throws MWException
* @return callable|null The old value of the mTagHooks array associated with the hook
*/
- public function setHook( $tag, $callback ) {
+ public function setHook( $tag, callable $callback ) {
$tag = strtolower( $tag );
if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
* @throws MWException
* @return callable|null The old value of the mTagHooks array associated with the hook
*/
- public function setTransparentTagHook( $tag, $callback ) {
+ public function setTransparentTagHook( $tag, callable $callback ) {
$tag = strtolower( $tag );
if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
throw new MWException( "Invalid character {$m[0]} in setTransparentHook('$tag', ...) call" );
* @throws MWException
* @return string|callable The old callback function for this name, if any
*/
- public function setFunctionHook( $id, $callback, $flags = 0 ) {
+ public function setFunctionHook( $id, callable $callback, $flags = 0 ) {
global $wgContLang;
$oldVal = isset( $this->mFunctionHooks[$id] ) ? $this->mFunctionHooks[$id][0] : null;
* @throws MWException
* @return null
*/
- public function setFunctionTagHook( $tag, $callback, $flags ) {
+ public function setFunctionTagHook( $tag, callable $callback, $flags ) {
$tag = strtolower( $tag );
if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
throw new MWException( "Invalid character {$m[0]} in setFunctionTagHook('$tag', ...) call" );
$ig->setContextTitle( $this->mTitle );
$ig->setShowBytes( false );
+ $ig->setShowDimensions( false );
$ig->setShowFilename( false );
$ig->setParser( $this );
$ig->setHideBadImages();