MediaWiki master
MediaWiki\HookContainer\DeprecatedHooks Class Reference

Public Member Functions

 __construct (array $deprecatedHooks=[])
 
 getDeprecationInfo (?string $hook=null)
 Gets deprecation info for a specific hook or all hooks if hook not specified.
 
 isHookDeprecated (string $hook)
 Checks whether hook is marked deprecated.
 
 markDeprecated (string $hook, string $version, ?string $component=null, bool $silent=false)
 For use by extensions, to add to list of deprecated hooks.
 

Detailed Description

Definition at line 27 of file DeprecatedHooks.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\HookContainer\DeprecatedHooks::__construct ( array $deprecatedHooks = [])
Parameters
array[]$deprecatedHooksList of hooks to mark as deprecated. Value arrays for each hook contain:
  • deprecatedVersion: (string) Version in which the hook was deprecated, to pass to wfDeprecated().
  • component: (string, optional) $component to pass to wfDeprecated().
  • silent: (bool, optional) True to not raise any deprecation warning

Definition at line 67 of file DeprecatedHooks.php.

References MediaWiki\HookContainer\DeprecatedHooks\markDeprecated().

Member Function Documentation

◆ getDeprecationInfo()

MediaWiki\HookContainer\DeprecatedHooks::getDeprecationInfo ( ?string $hook = null)

Gets deprecation info for a specific hook or all hooks if hook not specified.

Parameters
string | null$hook(optional) Hook name
Returns
array|null Value array from $this->deprecatedHooks for a specific hook or all hooks

Definition at line 124 of file DeprecatedHooks.php.

◆ isHookDeprecated()

MediaWiki\HookContainer\DeprecatedHooks::isHookDeprecated ( string $hook)

Checks whether hook is marked deprecated.

Parameters
string$hookHook name
Returns
bool

Definition at line 115 of file DeprecatedHooks.php.

◆ markDeprecated()

MediaWiki\HookContainer\DeprecatedHooks::markDeprecated ( string $hook,
string $version,
?string $component = null,
bool $silent = false )

For use by extensions, to add to list of deprecated hooks.

Core-defined hooks should instead be added to $this->$deprecatedHooks directly. However, the preferred method of marking a hook deprecated is by adding it to the DeprecatedHooks attribute in extension.json

Parameters
string$hook
string$versionVersion in which the hook was deprecated, to pass to wfDeprecated()
string | null$component(optional) component to pass to wfDeprecated().
bool$silentTrue to not raise any deprecation warning
Exceptions
InvalidArgumentExceptionHook has already been marked deprecated

Definition at line 90 of file DeprecatedHooks.php.

Referenced by MediaWiki\HookContainer\DeprecatedHooks\__construct().


The documentation for this class was generated from the following file: