24 private $deprecatedProperties;
41 array $deprecatedProperties,
43 string $component =
null
45 $this->container = $initializer;
46 $this->deprecatedProperties = $deprecatedProperties;
48 $this->component = $component;
52 $this->checkDeprecatedAccess( $offset,
'exists' );
53 return isset( $this->container[$offset] );
56 #[\ReturnTypeWillChange]
58 if ( $this->checkDeprecatedAccess( $offset,
'get' ) ) {
59 if ( is_callable( $this->container[$offset] ) ) {
60 $this->container[$offset] = call_user_func( $this->container[$offset] );
63 return $this->container[$offset] ??
null;
66 public function offsetSet( $offset, $value ): void {
67 if ( $offset === null ) {
68 $this->container[] = $value;
70 $this->container[$offset] = $value;
75 $this->checkDeprecatedAccess( $offset,
'unset' );
76 unset( $this->container[$offset] );
84 private function checkDeprecatedAccess( $offset,
string $fname ): bool {
85 if ( array_key_exists( $offset, $this->deprecatedProperties ) ) {
86 $deprecatedVersion = $this->deprecatedProperties[$offset];
88 "{$this->name} {$fname} '{$offset}'",
90 $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'))