aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Map/NamedParameterMap.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-02-15 18:29:24 +0000
committerMario <mario@mariovavti.com>2021-02-15 18:29:24 +0000
commit02401ea9fd5d53f590305c0f9834685cda58723d (patch)
treee60e292f8ae389c3a353dafda37003b4c15a45d5 /vendor/ramsey/collection/src/Map/NamedParameterMap.php
parent18c8f1b903e90ca3632520b90d21ec3770bf6e0b (diff)
downloadvolse-hubzilla-02401ea9fd5d53f590305c0f9834685cda58723d.tar.gz
volse-hubzilla-02401ea9fd5d53f590305c0f9834685cda58723d.tar.bz2
volse-hubzilla-02401ea9fd5d53f590305c0f9834685cda58723d.zip
composer update ramsey/collection
Diffstat (limited to 'vendor/ramsey/collection/src/Map/NamedParameterMap.php')
-rw-r--r--vendor/ramsey/collection/src/Map/NamedParameterMap.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/vendor/ramsey/collection/src/Map/NamedParameterMap.php b/vendor/ramsey/collection/src/Map/NamedParameterMap.php
index 7adfa0afd..ecc52f73a 100644
--- a/vendor/ramsey/collection/src/Map/NamedParameterMap.php
+++ b/vendor/ramsey/collection/src/Map/NamedParameterMap.php
@@ -25,6 +25,8 @@ use function is_int;
/**
* `NamedParameterMap` represents a mapping of values to a set of named keys
* that may optionally be typed
+ *
+ * @template-extends AbstractMap<mixed>
*/
class NamedParameterMap extends AbstractMap
{
@@ -34,15 +36,15 @@ class NamedParameterMap extends AbstractMap
/**
* Named parameters defined for this map.
*
- * @var array<mixed, string>
+ * @var array<string, string>
*/
protected $namedParameters;
/**
* Constructs a new `NamedParameterMap`.
*
- * @param array<mixed, string> $namedParameters The named parameters defined for this map.
- * @param mixed[] $data An initial set of data to set on this map.
+ * @param array<array-key, string> $namedParameters The named parameters defined for this map.
+ * @param array<array-key, mixed> $data An initial set of data to set on this map.
*/
public function __construct(array $namedParameters, array $data = [])
{
@@ -53,7 +55,7 @@ class NamedParameterMap extends AbstractMap
/**
* Returns named parameters set for this `NamedParameterMap`.
*
- * @return array<mixed, string>
+ * @return array<string, string>
*/
public function getNamedParameters(): array
{
@@ -61,17 +63,17 @@ class NamedParameterMap extends AbstractMap
}
/**
- * 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 not a
- * defined named parameter, or if the value is not of the type defined
- * for the given named parameter.
+ * @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 ' . var_export($value, true)
+ );
+ }
+
if (!array_key_exists($offset, $this->namedParameters)) {
throw new InvalidArgumentException(
'Attempting to set value for unconfigured parameter \''
@@ -94,9 +96,9 @@ class NamedParameterMap extends AbstractMap
* Given an array of named parameters, constructs a proper mapping of
* named parameters to types.
*
- * @param array<mixed, string> $namedParameters The named parameters to filter.
+ * @param array<array-key, string> $namedParameters The named parameters to filter.
*
- * @return array<mixed, string>
+ * @return array<string, string>
*/
protected function filterNamedParameters(array $namedParameters): array
{
@@ -105,11 +107,11 @@ class NamedParameterMap extends AbstractMap
foreach ($namedParameters as $key => $value) {
if (is_int($key)) {
- $names[] = (string) $value;
+ $names[] = $value;
$types[] = 'mixed';
} else {
$names[] = $key;
- $types[] = (string) $value;
+ $types[] = $value;
}
}