24 private $deprecatedProperties;
41 array $deprecatedProperties,
43 ?
string $component =
null
45 $this->container = $initializer;
46 $this->deprecatedProperties = $deprecatedProperties;
48 $this->component = $component;
53 $this->checkDeprecatedAccess( $offset,
'exists' );
54 return isset( $this->container[$offset] );
58 #[\ReturnTypeWillChange]
60 if ( $this->checkDeprecatedAccess( $offset,
'get' ) ) {
61 if ( is_callable( $this->container[$offset] ) ) {
62 $this->container[$offset] = $this->container[$offset]();
65 return $this->container[$offset] ??
null;
69 public function offsetSet( $offset, $value ): void {
70 if ( $offset === null ) {
71 $this->container[] = $value;
73 $this->container[$offset] = $value;
79 $this->checkDeprecatedAccess( $offset,
'unset' );
80 unset( $this->container[$offset] );
88 private function checkDeprecatedAccess( $offset,
string $fname ): bool {
89 if ( array_key_exists( $offset, $this->deprecatedProperties ) ) {
90 $deprecatedVersion = $this->deprecatedProperties[$offset];
92 "{$this->name} {$fname} '{$offset}'",
94 $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'))