aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Map/TypedMap.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/collection/src/Map/TypedMap.php')
-rw-r--r--vendor/ramsey/collection/src/Map/TypedMap.php39
1 files changed, 7 insertions, 32 deletions
diff --git a/vendor/ramsey/collection/src/Map/TypedMap.php b/vendor/ramsey/collection/src/Map/TypedMap.php
index 2e796377a..f914d9c70 100644
--- a/vendor/ramsey/collection/src/Map/TypedMap.php
+++ b/vendor/ramsey/collection/src/Map/TypedMap.php
@@ -14,13 +14,11 @@ declare(strict_types=1);
namespace Ramsey\Collection\Map;
-use Ramsey\Collection\Tool\TypeTrait;
-
/**
* A `TypedMap` represents a map of elements where key and value are typed.
*
* Each element is identified by a key with defined type and a value of defined
- * type. The keys of the map must be unique. The values on the map can be=
+ * type. The keys of the map must be unique. The values on the map can be
* repeated but each with its own different key.
*
* The most common case is to use a string type key, but it's not limited to
@@ -80,34 +78,12 @@ use Ramsey\Collection\Tool\TypeTrait;
* }
* ```
*
- * @template K
+ * @template K of array-key
* @template T
* @extends AbstractTypedMap<K, T>
*/
class TypedMap extends AbstractTypedMap
{
- use TypeTrait;
-
- /**
- * The data type of keys stored in this collection.
- *
- * A map key's type is immutable once it is set. For this reason, this
- * property is set private.
- *
- * @var string data type of the map key.
- */
- private $keyType;
-
- /**
- * The data type of values stored in this collection.
- *
- * A map value's type is immutable once it is set. For this reason, this
- * property is set private.
- *
- * @var string data type of the map value.
- */
- private $valueType;
-
/**
* Constructs a map object of the specified key and value types,
* optionally with the specified data.
@@ -116,12 +92,11 @@ class TypedMap extends AbstractTypedMap
* @param string $valueType The data type of the map's values.
* @param array<K, T> $data The initial data to set for this map.
*/
- public function __construct(string $keyType, string $valueType, array $data = [])
- {
- $this->keyType = $keyType;
- $this->valueType = $valueType;
-
- /** @psalm-suppress MixedArgumentTypeCoercion */
+ public function __construct(
+ private readonly string $keyType,
+ private readonly string $valueType,
+ array $data = [],
+ ) {
parent::__construct($data);
}