aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Collection.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/collection/src/Collection.php')
-rw-r--r--vendor/ramsey/collection/src/Collection.php23
1 files changed, 6 insertions, 17 deletions
diff --git a/vendor/ramsey/collection/src/Collection.php b/vendor/ramsey/collection/src/Collection.php
index 1299c12c2..3b0f7689d 100644
--- a/vendor/ramsey/collection/src/Collection.php
+++ b/vendor/ramsey/collection/src/Collection.php
@@ -24,7 +24,7 @@ namespace Ramsey\Collection;
*
* Example usage:
*
- * ``` php
+ * ```
* $collection = new \Ramsey\Collection\Collection('My\\Foo');
* $collection->add(new \My\Foo());
* $collection->add(new \My\Foo());
@@ -37,7 +37,7 @@ namespace Ramsey\Collection;
* It is preferable to subclass `AbstractCollection` to create your own typed
* collections. For example:
*
- * ``` php
+ * ```
* namespace My\Foo;
*
* class FooCollection extends \Ramsey\Collection\AbstractCollection
@@ -51,7 +51,7 @@ namespace Ramsey\Collection;
*
* And then use it similarly to the earlier example:
*
- * ``` php
+ * ```
* $fooCollection = new \My\Foo\FooCollection();
* $fooCollection->add(new \My\Foo());
* $fooCollection->add(new \My\Foo());
@@ -64,7 +64,7 @@ namespace Ramsey\Collection;
* The benefit with this approach is that you may do type-checking on the
* collection object:
*
- * ``` php
+ * ```
* if ($collection instanceof \My\Foo\FooCollection) {
* // the collection is a collection of My\Foo objects
* }
@@ -76,26 +76,15 @@ namespace Ramsey\Collection;
class Collection extends AbstractCollection
{
/**
- * The type of elements stored in this collection.
- *
- * A collection's type is immutable once it is set. For this reason, this
- * property is set private.
- *
- * @var string
- */
- private $collectionType;
-
- /**
* Constructs a collection object of the specified type, optionally with the
* specified data.
*
- * @param string $collectionType The type (FQCN) associated with this
+ * @param string $collectionType The type or class name associated with this
* collection.
* @param array<array-key, T> $data The initial items to store in the collection.
*/
- public function __construct(string $collectionType, array $data = [])
+ public function __construct(private readonly string $collectionType, array $data = [])
{
- $this->collectionType = $collectionType;
parent::__construct($data);
}