Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 8.1] Add #[\ReturnTypeWillChange] #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Stringy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand Down