class DeprecatedArray

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/Utility/DeprecatedArray.php \Drupal\Component\Utility\DeprecatedArray
  2. 8.9.x core/lib/Drupal/Component/Utility/DeprecatedArray.php \Drupal\Component\Utility\DeprecatedArray
  3. 10 core/lib/Drupal/Component/Utility/DeprecatedArray.php \Drupal\Component\Utility\DeprecatedArray

An array that triggers a deprecation warning when accessed.

Hierarchy

  • class \Drupal\Component\Utility\DeprecatedArray extends \Drupal\Component\Utility\ArrayObject

Expanded class hierarchy of DeprecatedArray

File

core/lib/Drupal/Component/Utility/DeprecatedArray.php, line 8

Namespace

Drupal\Component\Utility
View source
class DeprecatedArray extends \ArrayObject {
    
    /**
     * The deprecation message.
     *
     * @var string
     */
    protected $message;
    
    /**
     * DeprecatedArray constructor.
     *
     * @param array $values
     *   The array values.
     * @param $message
     *   The deprecation message.
     */
    public function __construct(array $values, $message) {
        $this->message = $message;
        parent::__construct($values);
    }
    
    /**
     * {@inheritdoc}
     */
    public function offsetExists($offset) : bool {
        @trigger_error($this->message, E_USER_DEPRECATED);
        return parent::offsetExists($offset);
    }
    
    /**
     * {@inheritdoc}
     */
    public function offsetGet($offset) : mixed {
        @trigger_error($this->message, E_USER_DEPRECATED);
        return parent::offsetGet($offset);
    }
    
    /**
     * {@inheritdoc}
     */
    public function offsetSet($offset, $value) : void {
        @trigger_error($this->message, E_USER_DEPRECATED);
        parent::offsetSet($offset, $value);
    }
    
    /**
     * {@inheritdoc}
     */
    public function offsetUnset($offset) : void {
        @trigger_error($this->message, E_USER_DEPRECATED);
        parent::offsetUnset($offset);
    }
    
    /**
     * {@inheritdoc}
     */
    public function getIterator() : \ArrayIterator {
        @trigger_error($this->message, E_USER_DEPRECATED);
        return parent::getIterator();
    }
    
    /**
     * {@inheritdoc}
     */
    public function unserialize($serialized) : void {
        @trigger_error($this->message, E_USER_DEPRECATED);
        parent::unserialize($serialized);
    }
    
    /**
     * {@inheritdoc}
     */
    public function serialize() : string {
        @trigger_error($this->message, E_USER_DEPRECATED);
        return parent::serialize();
    }
    
    /**
     * {@inheritdoc}
     */
    public function count() : int {
        @trigger_error($this->message, E_USER_DEPRECATED);
        return parent::count();
    }

}

Members

Title Sort descending Modifiers Object type Summary
DeprecatedArray::$message protected property The deprecation message.
DeprecatedArray::count public function
DeprecatedArray::getIterator public function
DeprecatedArray::offsetExists public function
DeprecatedArray::offsetGet public function
DeprecatedArray::offsetSet public function
DeprecatedArray::offsetUnset public function
DeprecatedArray::serialize public function
DeprecatedArray::unserialize public function
DeprecatedArray::__construct public function DeprecatedArray constructor.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.