diff options
author | Hilmar R <u02@u29lx193> | 2021-02-28 21:06:16 +0100 |
---|---|---|
committer | Hilmar R <u02@u29lx193> | 2021-03-01 18:48:11 +0100 |
commit | c26dede97f626b52b7bf8962ed55d1dbda86abe8 (patch) | |
tree | 3c8c9bc97aa09f7ce9afe9bf467cf87bbf2c7d0b /vendor/ramsey/collection/src/Map/AbstractMap.php | |
parent | ea3390d626f85b7293a750958bfd1b5460958365 (diff) | |
download | volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.gz volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.bz2 volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.zip |
get dev
Diffstat (limited to 'vendor/ramsey/collection/src/Map/AbstractMap.php')
-rw-r--r-- | vendor/ramsey/collection/src/Map/AbstractMap.php | 96 |
1 files changed, 16 insertions, 80 deletions
diff --git a/vendor/ramsey/collection/src/Map/AbstractMap.php b/vendor/ramsey/collection/src/Map/AbstractMap.php index 6b2e97a08..70f71160c 100644 --- a/vendor/ramsey/collection/src/Map/AbstractMap.php +++ b/vendor/ramsey/collection/src/Map/AbstractMap.php @@ -24,23 +24,22 @@ use function in_array; /** * This class provides a basic implementation of `MapInterface`, to minimize the * effort required to implement this interface. + * + * @template T + * @template-extends AbstractArray<T> + * @template-implements MapInterface<T> */ abstract class AbstractMap extends AbstractArray implements MapInterface { /** - * Sets the given value to the given offset in the map. - * - * @param mixed $offset The offset to set. - * @param mixed $value The value to set at the given offset. - * - * @throws InvalidArgumentException if the offset provided is `null`. + * @inheritDoc */ public function offsetSet($offset, $value): void { if ($offset === null) { throw new InvalidArgumentException( 'Map elements are key/value pairs; a key must be provided for ' - . 'value ' . $value + . 'value ' . var_export($value, true) ); } @@ -48,9 +47,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Returns `true` if this map contains a mapping for the specified key. - * - * @param mixed $key The key to check in the map. + * @inheritDoc */ public function containsKey($key): bool { @@ -58,11 +55,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Returns `true` if this map maps one or more keys to the specified value. - * - * This performs a strict type check on the value. - * - * @param mixed $value The value to check in the map. + * @inheritDoc */ public function containsValue($value): bool { @@ -70,9 +63,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Return an array of the keys contained in this map. - * - * @return mixed[] + * @inheritDoc */ public function keys(): array { @@ -80,14 +71,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Returns the value to which the specified key is mapped, `null` if this - * map contains no mapping for the key, or (optionally) `$defaultValue` if - * this map contains no mapping for the key. - * - * @param mixed $key The key to return from the map. - * @param mixed $defaultValue The default value to use if `$key` is not found. - * - * @return mixed|null the value or `null` if the key could not be found. + * @inheritDoc */ public function get($key, $defaultValue = null) { @@ -99,16 +83,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Associates the specified value with the specified key in this map. - * - * If the map previously contained a mapping for the key, the old value is - * replaced by the specified value. - * - * @param mixed $key The key to put or replace in the map. - * @param mixed $value The value to store at `$key`. - * - * @return mixed|null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ public function put($key, $value) { @@ -119,17 +94,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Associates the specified value with the specified key in this map only if - * it is not already set. - * - * If there is already a value associated with `$key`, this returns that - * value without replacing it. - * - * @param mixed $key The key to put in the map. - * @param mixed $value The value to store at `$key`. - * - * @return mixed|null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ public function putIfAbsent($key, $value) { @@ -143,12 +108,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Removes the mapping for a key from this map if it is present. - * - * @param mixed $key The key to remove from the map. - * - * @return mixed|null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ public function remove($key) { @@ -159,15 +119,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Removes the entry for the specified key only if it is currently mapped to - * the specified value. - * - * This performs a strict type check on the value. - * - * @param mixed $key The key to remove from the map. - * @param mixed $value The value to match. - * - * @return bool true if the value was removed. + * @inheritDoc */ public function removeIf($key, $value): bool { @@ -181,14 +133,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Replaces the entry for the specified key only if it is currently mapped - * to some value. - * - * @param mixed $key The key to replace. - * @param mixed $value The value to set at `$key`. - * - * @return mixed|null the previous value associated with key, or `null` if - * there was no mapping for `$key`. + * @inheritDoc */ public function replace($key, $value) { @@ -202,16 +147,7 @@ abstract class AbstractMap extends AbstractArray implements MapInterface } /** - * Replaces the entry for the specified key only if currently mapped to the - * specified value. - * - * This performs a strict type check on the value. - * - * @param mixed $key The key to remove from the map. - * @param mixed $oldValue The value to match. - * @param mixed $newValue The value to use as a replacement. - * - * @return bool true if the value was replaced. + * @inheritDoc */ public function replaceIf($key, $oldValue, $newValue): bool { |