22 private $deprecatedProperties;
39 array $deprecatedProperties,
41 string $component =
null
43 $this->container = $initializer;
44 $this->deprecatedProperties = $deprecatedProperties;
46 $this->component = $component;
50 $this->checkDeprecatedAccess( $offset,
'exists' );
51 return isset( $this->container[$offset] );
54 #[\ReturnTypeWillChange]
56 if ( $this->checkDeprecatedAccess( $offset,
'get' ) ) {
57 if ( is_callable( $this->container[$offset] ) ) {
58 $this->container[$offset] = call_user_func( $this->container[$offset] );
61 return $this->container[$offset] ??
null;
64 public function offsetSet( $offset, $value ): void {
65 if ( $offset === null ) {
66 $this->container[] = $value;
68 $this->container[$offset] = $value;
73 $this->checkDeprecatedAccess( $offset,
'unset' );
74 unset( $this->container[$offset] );
82 private function checkDeprecatedAccess( $offset,
string $fname ): bool {
83 if ( array_key_exists( $offset, $this->deprecatedProperties ) ) {
84 $deprecatedVersion = $this->deprecatedProperties[$offset];
86 "{$this->name} {$fname} '{$offset}'",
88 $this->component ??
false,
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.