aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Map/MapInterface.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/collection/src/Map/MapInterface.php')
-rw-r--r--vendor/ramsey/collection/src/Map/MapInterface.php55
1 files changed, 33 insertions, 22 deletions
diff --git a/vendor/ramsey/collection/src/Map/MapInterface.php b/vendor/ramsey/collection/src/Map/MapInterface.php
index 500bdb2d0..04e52a238 100644
--- a/vendor/ramsey/collection/src/Map/MapInterface.php
+++ b/vendor/ramsey/collection/src/Map/MapInterface.php
@@ -20,13 +20,16 @@ use Ramsey\Collection\ArrayInterface;
* An object that maps keys to values.
*
* A map cannot contain duplicate keys; each key can map to at most one value.
+ *
+ * @template T
+ * @template-extends ArrayInterface<T>
*/
interface MapInterface extends ArrayInterface
{
/**
* Returns `true` if this map contains a mapping for the specified key.
*
- * @param mixed $key The key to check in the map.
+ * @param array-key $key The key to check in the map.
*/
public function containsKey($key): bool;
@@ -35,14 +38,15 @@ interface MapInterface extends ArrayInterface
*
* This performs a strict type check on the value.
*
- * @param mixed $value The value to check in the map.
+ * @param T $value The value to check in the map.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function containsValue($value): bool;
/**
* Return an array of the keys contained in this map.
*
- * @return mixed[]
+ * @return list<array-key>
*/
public function keys(): array;
@@ -51,11 +55,12 @@ interface MapInterface extends ArrayInterface
* 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.
+ * @param array-key $key The key to return from the map.
+ * @param T|null $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.
+ * @return T|null the value or `null` if the key could not be found.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function get($key, $defaultValue = null);
/**
@@ -64,12 +69,13 @@ interface MapInterface extends ArrayInterface
* 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`.
+ * @param array-key $key The key to put or replace in the map.
+ * @param T $value The value to store at `$key`.
*
- * @return mixed|null the previous value associated with key, or `null` if
+ * @return T|null the previous value associated with key, or `null` if
* there was no mapping for `$key`.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function put($key, $value);
/**
@@ -79,22 +85,24 @@ interface MapInterface extends ArrayInterface
* 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`.
+ * @param array-key $key The key to put in the map.
+ * @param T $value The value to store at `$key`.
*
- * @return mixed|null the previous value associated with key, or `null` if
+ * @return T|null the previous value associated with key, or `null` if
* there was no mapping for `$key`.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function putIfAbsent($key, $value);
/**
* Removes the mapping for a key from this map if it is present.
*
- * @param mixed $key The key to remove from the map.
+ * @param array-key $key The key to remove from the map.
*
- * @return mixed|null the previous value associated with key, or `null` if
+ * @return T|null the previous value associated with key, or `null` if
* there was no mapping for `$key`.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function remove($key);
/**
@@ -103,23 +111,25 @@ interface MapInterface extends ArrayInterface
*
* 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.
+ * @param array-key $key The key to remove from the map.
+ * @param T $value The value to match.
*
* @return bool true if the value was removed.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function removeIf($key, $value): bool;
/**
* 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`.
+ * @param array-key $key The key to replace.
+ * @param T $value The value to set at `$key`.
*
- * @return mixed|null the previous value associated with key, or `null` if
+ * @return T|null the previous value associated with key, or `null` if
* there was no mapping for `$key`.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function replace($key, $value);
/**
@@ -128,11 +138,12 @@ interface MapInterface extends ArrayInterface
*
* 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.
+ * @param array-key $key The key to remove from the map.
+ * @param T $oldValue The value to match.
+ * @param T $newValue The value to use as a replacement.
*
* @return bool true if the value was replaced.
*/
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
public function replaceIf($key, $oldValue, $newValue): bool;
}