ArrayInterface.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * This file is part of the ramsey/collection library
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
  9. * @license http://opensource.org/licenses/MIT MIT
  10. */
  11. declare(strict_types=1);
  12. namespace Ramsey\Collection;
  13. use ArrayAccess;
  14. use Countable;
  15. use IteratorAggregate;
  16. /**
  17. * `ArrayInterface` provides traversable array functionality to data types.
  18. *
  19. * @template T
  20. * @extends ArrayAccess<array-key, T>
  21. * @extends IteratorAggregate<array-key, T>
  22. */
  23. interface ArrayInterface extends
  24. ArrayAccess,
  25. Countable,
  26. IteratorAggregate
  27. {
  28. /**
  29. * Removes all items from this array.
  30. */
  31. public function clear(): void;
  32. /**
  33. * Returns a native PHP array representation of this array object.
  34. *
  35. * @return array<array-key, T>
  36. */
  37. public function toArray(): array;
  38. /**
  39. * Returns `true` if this array is empty.
  40. */
  41. public function isEmpty(): bool;
  42. }