diff options
| author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
| commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
| tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/collections/src/Collection.php | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/collections/src/Collection.php')
| -rw-r--r-- | vendor/doctrine/collections/src/Collection.php | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/vendor/doctrine/collections/src/Collection.php b/vendor/doctrine/collections/src/Collection.php new file mode 100644 index 0000000..c3c62aa --- /dev/null +++ b/vendor/doctrine/collections/src/Collection.php | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\Common\Collections; | ||
| 6 | |||
| 7 | use ArrayAccess; | ||
| 8 | use Closure; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * The missing (SPL) Collection/Array/OrderedMap interface. | ||
| 12 | * | ||
| 13 | * A Collection resembles the nature of a regular PHP array. That is, | ||
| 14 | * it is essentially an <b>ordered map</b> that can also be used | ||
| 15 | * like a list. | ||
| 16 | * | ||
| 17 | * A Collection has an internal iterator just like a PHP array. In addition, | ||
| 18 | * a Collection can be iterated with external iterators, which is preferable. | ||
| 19 | * To use an external iterator simply use the foreach language construct to | ||
| 20 | * iterate over the collection (which calls {@link getIterator()} internally) or | ||
| 21 | * explicitly retrieve an iterator though {@link getIterator()} which can then be | ||
| 22 | * used to iterate over the collection. | ||
| 23 | * You can not rely on the internal iterator of the collection being at a certain | ||
| 24 | * position unless you explicitly positioned it before. Prefer iteration with | ||
| 25 | * external iterators. | ||
| 26 | * | ||
| 27 | * @psalm-template TKey of array-key | ||
| 28 | * @psalm-template T | ||
| 29 | * @template-extends ReadableCollection<TKey, T> | ||
| 30 | * @template-extends ArrayAccess<TKey, T> | ||
| 31 | */ | ||
| 32 | interface Collection extends ReadableCollection, ArrayAccess | ||
| 33 | { | ||
| 34 | /** | ||
| 35 | * Adds an element at the end of the collection. | ||
| 36 | * | ||
| 37 | * @param mixed $element The element to add. | ||
| 38 | * @psalm-param T $element | ||
| 39 | * | ||
| 40 | * @return void we will require a native return type declaration in 3.0 | ||
| 41 | */ | ||
| 42 | public function add(mixed $element); | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Clears the collection, removing all elements. | ||
| 46 | * | ||
| 47 | * @return void | ||
| 48 | */ | ||
| 49 | public function clear(); | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Removes the element at the specified index from the collection. | ||
| 53 | * | ||
| 54 | * @param string|int $key The key/index of the element to remove. | ||
| 55 | * @psalm-param TKey $key | ||
| 56 | * | ||
| 57 | * @return mixed The removed element or NULL, if the collection did not contain the element. | ||
| 58 | * @psalm-return T|null | ||
| 59 | */ | ||
| 60 | public function remove(string|int $key); | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Removes the specified element from the collection, if it is found. | ||
| 64 | * | ||
| 65 | * @param mixed $element The element to remove. | ||
| 66 | * @psalm-param T $element | ||
| 67 | * | ||
| 68 | * @return bool TRUE if this collection contained the specified element, FALSE otherwise. | ||
| 69 | */ | ||
| 70 | public function removeElement(mixed $element); | ||
| 71 | |||
| 72 | /** | ||
| 73 | * Sets an element in the collection at the specified key/index. | ||
| 74 | * | ||
| 75 | * @param string|int $key The key/index of the element to set. | ||
| 76 | * @param mixed $value The element to set. | ||
| 77 | * @psalm-param TKey $key | ||
| 78 | * @psalm-param T $value | ||
| 79 | * | ||
| 80 | * @return void | ||
| 81 | */ | ||
| 82 | public function set(string|int $key, mixed $value); | ||
| 83 | |||
| 84 | /** | ||
| 85 | * {@inheritDoc} | ||
| 86 | * | ||
| 87 | * @psalm-param Closure(T):U $func | ||
| 88 | * | ||
| 89 | * @return Collection<mixed> | ||
| 90 | * @psalm-return Collection<TKey, U> | ||
| 91 | * | ||
| 92 | * @psalm-template U | ||
| 93 | */ | ||
| 94 | public function map(Closure $func); | ||
| 95 | |||
| 96 | /** | ||
| 97 | * {@inheritDoc} | ||
| 98 | * | ||
| 99 | * @psalm-param Closure(T, TKey):bool $p | ||
| 100 | * | ||
| 101 | * @return Collection<mixed> A collection with the results of the filter operation. | ||
| 102 | * @psalm-return Collection<TKey, T> | ||
| 103 | */ | ||
| 104 | public function filter(Closure $p); | ||
| 105 | |||
| 106 | /** | ||
| 107 | * {@inheritDoc} | ||
| 108 | * | ||
| 109 | * @psalm-param Closure(TKey, T):bool $p | ||
| 110 | * | ||
| 111 | * @return Collection<mixed>[] An array with two elements. The first element contains the collection | ||
| 112 | * of elements where the predicate returned TRUE, the second element | ||
| 113 | * contains the collection of elements where the predicate returned FALSE. | ||
| 114 | * @psalm-return array{0: Collection<TKey, T>, 1: Collection<TKey, T>} | ||
| 115 | */ | ||
| 116 | public function partition(Closure $p); | ||
| 117 | } | ||
