From 9c9e52782ea6586b841de3650fc332a9eed50df8 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:42:50 +0100 Subject: [PATCH 1/3] DefaultSecuritySettings: Add returned type Needed for PHP 8.1+ "PHP Deprecated: Return type of Raml\SecurityScheme\SecuritySettings\DefaultSecuritySettings::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice" "PHP Deprecated: Return type of Raml\SecurityScheme\SecuritySettings\DefaultSecuritySettings::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice" --- .../SecuritySettings/DefaultSecuritySettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SecurityScheme/SecuritySettings/DefaultSecuritySettings.php b/src/SecurityScheme/SecuritySettings/DefaultSecuritySettings.php index 6d1bcf7c..a085ccf0 100644 --- a/src/SecurityScheme/SecuritySettings/DefaultSecuritySettings.php +++ b/src/SecurityScheme/SecuritySettings/DefaultSecuritySettings.php @@ -70,7 +70,7 @@ public function offsetSet($offset, $value): void * * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->settings[$offset]); } @@ -88,7 +88,7 @@ public function offsetUnset($offset): void * Get a single settings value * @link http://php.net/manual/en/arrayaccess.offsetget.php */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->settings[$offset] ?? null; } From 0a95c5b761000b44b24f1ab0573bf8cffb51369f Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:50:59 +0100 Subject: [PATCH 2/3] TypeCollection: Add returned types Needed for PHP 8.1+ "PHP Deprecated: Return type of Raml\TypeCollection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice" "PHP Deprecated: Return type of Raml\TypeCollection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice" "PHP Deprecated: Return type of Raml\TypeCollection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice" --- src/TypeCollection.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TypeCollection.php b/src/TypeCollection.php index 344495da..88b25886 100644 --- a/src/TypeCollection.php +++ b/src/TypeCollection.php @@ -52,7 +52,7 @@ public static function getInstance() /** * {@inheritDoc} */ - public function current() + public function current(): mixed { return $this->collection[$this->position]; } @@ -60,7 +60,7 @@ public function current() /** * {@inheritDoc} */ - public function key() + public function key(): mixed { return $this->position; } @@ -84,7 +84,7 @@ public function rewind(): void /** * {@inheritDoc} */ - public function valid() + public function valid(): bool { return isset($this->collection[$this->position]); } From 002eb87ef25c9ee4842ad5513e39ab6e2a1ae280 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:55:40 +0100 Subject: [PATCH 3/3] TraitCollection: Add returned types Needed for PHP 8.1+ "Deprecated: Return type of Raml\TraitCollection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice" --- src/TraitCollection.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/TraitCollection.php b/src/TraitCollection.php index d59d159a..a83b6a5d 100644 --- a/src/TraitCollection.php +++ b/src/TraitCollection.php @@ -55,10 +55,7 @@ public static function getInstance() return self::$instance; } - /** - * @return TraitDefinition - */ - public function current() + public function current(): TraitDefinition { if ($this->valid()) { return $this->collection[$this->position]; @@ -67,10 +64,7 @@ public function current() throw new InvalidKeyException($this->position); } - /** - * @return int - */ - public function key() + public function key(): int { return $this->position; } @@ -85,10 +79,7 @@ public function rewind(): void $this->position = 0; } - /** - * @return bool - */ - public function valid() + public function valid(): bool { return isset($this->collection[$this->position]); }