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. More...
 
 isHookDeprecated (string $hook)
 Checks whether hook is marked deprecated. More...
 
 markDeprecated (string $hook, string $version, ?string $component=null, bool $silent=false)
 For use by extensions, to add to list of deprecated hooks. More...
 

Private Attributes

array[] $deprecatedHooks
 List of deprecated hooks. More...
 

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 87 of file DeprecatedHooks.php.

References MediaWiki\HookContainer\DeprecatedHooks\$deprecatedHooks, and 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 144 of file DeprecatedHooks.php.

References MediaWiki\HookContainer\DeprecatedHooks\$deprecatedHooks.

◆ isHookDeprecated()

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

Checks whether hook is marked deprecated.

Parameters
string$hookHook name
Returns
bool

Definition at line 135 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 110 of file DeprecatedHooks.php.

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

Member Data Documentation

◆ $deprecatedHooks

array [] MediaWiki\HookContainer\DeprecatedHooks::$deprecatedHooks
private

List of deprecated hooks.

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) If true, no deprecation warning will be raised

Definition at line 36 of file DeprecatedHooks.php.

Referenced by MediaWiki\HookContainer\DeprecatedHooks\__construct(), and MediaWiki\HookContainer\DeprecatedHooks\getDeprecationInfo().


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