From 1c685baef8ec3c3262e9f2aa3da3a70ca9d3dd2a Mon Sep 17 00:00:00 2001 From: Unay Santisteban Date: Mon, 7 Nov 2022 22:18:53 +0100 Subject: [PATCH] Feature/Upgrade illuminate/collections package. --- composer.json | 2 +- src/Traits/IsModel.php | 4 ++-- src/TypedCollection.php | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 93d1d6e..50c59fe 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "ext-json": "*", "ramsey/uuid": "^4.1", "nesbot/carbon": "^2.40", - "illuminate/collections": "^8.20", + "illuminate/collections": "^9.0.0", "lambdish/phunctional": "^2.1", "doctrine/instantiator": "^1.4", "complex-heart/contracts": "^1.0.0" diff --git a/src/Traits/IsModel.php b/src/Traits/IsModel.php index f301d09..edc59a3 100644 --- a/src/Traits/IsModel.php +++ b/src/Traits/IsModel.php @@ -22,7 +22,7 @@ trait IsModel /** * Initialize the Model. Just as the constructor will do. * - * @param array $source + * @param array $source * @param callable|null $onFail * * @return static @@ -76,7 +76,7 @@ protected function withOverrides(array $overrides) final protected function mapSource(array $source): array { // check if the array is indexed or associative. - $isIndexed = fn($source): bool => !([] === $source) && array_keys($source) === range(0, count($source) - 1); + $isIndexed = fn($source): bool => ([] !== $source) && array_keys($source) === range(0, count($source) - 1); return $isIndexed($source) // combine the attributes keys with the provided source values. diff --git a/src/TypedCollection.php b/src/TypedCollection.php index 26cad7f..a9020c9 100644 --- a/src/TypedCollection.php +++ b/src/TypedCollection.php @@ -138,8 +138,7 @@ public function push(...$values) * * @throws InvariantViolation */ - #[\ReturnTypeWillChange] - public function offsetSet($key, $value) + public function offsetSet($key, $value): void { if ($this->keyType !== 'mixed') { $this->checkKeyType($key); @@ -154,7 +153,7 @@ public function offsetSet($key, $value) * Push an item onto the beginning of the collection. * * @param mixed $value - * @param null $key + * @param int|string $key * * @return static * @throws InvariantViolation