MediaWiki REL1_35
MediaWiki\Debug\DeprecatablePropertyArray Class Reference

ArrayAccess implementation that supports deprecating access to certain properties. More...

Inheritance diagram for MediaWiki\Debug\DeprecatablePropertyArray:
Collaboration diagram for MediaWiki\Debug\DeprecatablePropertyArray:

Public Member Functions

 __construct (array $initializer, array $deprecatedProperties, string $name, string $component=null)
 offsetExists ( $offset)
 offsetGet ( $offset)
 offsetSet ( $offset, $value)
 offsetUnset ( $offset)

Private Member Functions

 checkDeprecatedAccess ( $offset, string $fname)

Private Attributes

string null $component
array $container
array $deprecatedProperties
 Map of deprecated property names to deprecation versions.
string $name

Detailed Description

ArrayAccess implementation that supports deprecating access to certain properties.

It behaves mostly as a normal array, however in order to avoid instantiating deprecated properties by default, a callable initializer can be set to the property. It will be executed upon 'get'.

setting properties does not emit deprecation warnings. @newable

Definition at line 16 of file DeprecatablePropertyArray.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Debug\DeprecatablePropertyArray::__construct ( array  $initializer,
array  $deprecatedProperties,
string  $name,
string  $component = null 
array$initializerInitial value of the array.
array$deprecatedPropertiesMap of deprecated property names to versions.
string$nameDescriptive identifier for the array
string | null$componentComponent to which array belongs. If not provided, assumed to be MW Core

Definition at line 37 of file DeprecatablePropertyArray.php.

References MediaWiki\Debug\DeprecatablePropertyArray\$component, MediaWiki\Debug\DeprecatablePropertyArray\$deprecatedProperties, and MediaWiki\Debug\DeprecatablePropertyArray\$name.

Member Function Documentation

◆ checkDeprecatedAccess()

MediaWiki\Debug\DeprecatablePropertyArray::checkDeprecatedAccess (   $offset,
string  $fname 
string | int$offset

Definition at line 82 of file DeprecatablePropertyArray.php.

References wfDeprecated().

◆ offsetExists()

MediaWiki\Debug\DeprecatablePropertyArray::offsetExists (   $offset)

Definition at line 49 of file DeprecatablePropertyArray.php.

◆ offsetGet()

MediaWiki\Debug\DeprecatablePropertyArray::offsetGet (   $offset)

Definition at line 55 of file DeprecatablePropertyArray.php.

◆ offsetSet()

MediaWiki\Debug\DeprecatablePropertyArray::offsetSet (   $offset,

Definition at line 64 of file DeprecatablePropertyArray.php.

◆ offsetUnset()

MediaWiki\Debug\DeprecatablePropertyArray::offsetUnset (   $offset)

Definition at line 72 of file DeprecatablePropertyArray.php.

Member Data Documentation

◆ $component

string null MediaWiki\Debug\DeprecatablePropertyArray::$component

◆ $container

array MediaWiki\Debug\DeprecatablePropertyArray::$container

Definition at line 19 of file DeprecatablePropertyArray.php.

◆ $deprecatedProperties

array MediaWiki\Debug\DeprecatablePropertyArray::$deprecatedProperties

Map of deprecated property names to deprecation versions.

Definition at line 22 of file DeprecatablePropertyArray.php.

Referenced by MediaWiki\Debug\DeprecatablePropertyArray\__construct().

◆ $name

string MediaWiki\Debug\DeprecatablePropertyArray::$name

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