From 941696eff781e8c9c454e3b60c016371aae1749b Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 2 Dec 2021 18:02:45 +0700 Subject: [PATCH] [PHP 8.1] Add #[\ReturnTypeWillChange] --- src/Stringy.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Stringy.php b/src/Stringy.php index ccb6f5aa..596811b4 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -267,6 +267,7 @@ public function containsAny($needles, $caseSensitive = true) * * @return int The number of characters in the string, given the encoding */ + #[\ReturnTypeWillChange] public function count() { return $this->length(); @@ -450,6 +451,7 @@ public function getEncoding() * * @return \ArrayIterator An iterator for the characters in the string */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->chars()); @@ -847,6 +849,7 @@ public function lowerCaseFirst() * @param mixed $offset The index to check * @return boolean Whether or not the index exists */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { $length = $this->length(); @@ -870,6 +873,7 @@ public function offsetExists($offset) * @throws \OutOfBoundsException If the positive or negative offset does * not exist */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { $offset = (int) $offset; @@ -890,6 +894,7 @@ public function offsetGet($offset) * @param mixed $value Value to set * @throws \Exception When called */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { // Stringy is immutable, cannot directly set char @@ -903,6 +908,7 @@ public function offsetSet($offset, $value) * @param mixed $offset The index of the character * @throws \Exception When called */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { // Don't allow directly modifying the string