You are here

class DeprecatedArray in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Utility/DeprecatedArray.php \Drupal\Component\Utility\DeprecatedArray
  2. 9 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}
   */

  #[\ReturnTypeWillChange]
  public function offsetExists($offset) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    return parent::offsetExists($offset);
  }

  /**
   * {@inheritdoc}
   */

  #[\ReturnTypeWillChange]
  public function offsetGet($offset) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    return parent::offsetGet($offset);
  }

  /**
   * {@inheritdoc}
   */

  #[\ReturnTypeWillChange]
  public function offsetSet($offset, $value) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    parent::offsetSet($offset, $value);
  }

  /**
   * {@inheritdoc}
   */

  #[\ReturnTypeWillChange]
  public function offsetUnset($offset) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    parent::offsetUnset($offset);
  }

  /**
   * {@inheritdoc}
   */

  #[\ReturnTypeWillChange]
  public function getIterator() {
    @trigger_error($this->message, E_USER_DEPRECATED);
    return parent::getIterator();
  }

  /**
   * {@inheritdoc}
   */
  public function unserialize($serialized) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    parent::unserialize($serialized);
  }

  /**
   * {@inheritdoc}
   */
  public function serialize() {
    @trigger_error($this->message, E_USER_DEPRECATED);
    return parent::serialize();
  }

  /**
   * {@inheritdoc}
   */

  #[\ReturnTypeWillChange]
  public function count() {
    @trigger_error($this->message, E_USER_DEPRECATED);
    return parent::count();
  }

}

Members