Skip to content

Commit

Permalink
Fix PHP 8.1 deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jul 20, 2021
1 parent 2e05624 commit b44dcc8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/_files/ArrayAccessible.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ public function __construct(array $array = [])
$this->array = $array;
}

#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return \array_key_exists($offset, $this->array);
}

#[ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->array[$offset];
Expand All @@ -40,6 +42,7 @@ public function offsetUnset($offset): void
unset($this->array[$offset]);
}

#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->array);
Expand Down
2 changes: 1 addition & 1 deletion tests/_files/DoubleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(TestCase $testCase)
$this->testCase = $testCase;
}

public function count()
public function count(): int
{
return 2;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/_files/SampleArrayAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function offsetSet($offset, $value): void
}
}

#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->container[$offset]);
Expand All @@ -35,6 +36,7 @@ public function offsetUnset($offset): void
unset($this->container[$offset]);
}

#[ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
Expand Down
3 changes: 3 additions & 0 deletions tests/_files/TestIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ public function rewind(): void
$this->position = 0;
}

#[ReturnTypeWillChange]
public function valid()
{
return $this->position < \count($this->array);
}

#[ReturnTypeWillChange]
public function key()
{
return $this->position;
}

#[ReturnTypeWillChange]
public function current()
{
return $this->array[$this->position];
Expand Down
3 changes: 3 additions & 0 deletions tests/_files/TestIterator2.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function __construct(array $array)
$this->data = $array;
}

#[ReturnTypeWillChange]
public function current()
{
return \current($this->data);
Expand All @@ -26,11 +27,13 @@ public function next(): void
\next($this->data);
}

#[ReturnTypeWillChange]
public function key()
{
return \key($this->data);
}

#[ReturnTypeWillChange]
public function valid()
{
return \key($this->data) !== null;
Expand Down
1 change: 1 addition & 0 deletions tests/_files/TestIteratorAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function __construct(Traversable $traversable)
$this->traversable = $traversable;
}

#[ReturnTypeWillChange]
public function getIterator()
{
return $this->traversable;
Expand Down
1 change: 1 addition & 0 deletions tests/_files/TestIteratorAggregate2.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function __construct(Traversable $traversable)
$this->traversable = $traversable;
}

#[ReturnTypeWillChange]
public function getIterator()
{
return $this->traversable;
Expand Down
1 change: 1 addition & 0 deletions tests/_files/WrapperIteratorAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function __construct($baseCollection)
$this->baseCollection = $baseCollection;
}

#[ReturnTypeWillChange]
public function getIterator()
{
foreach ($this->baseCollection as $k => $v) {
Expand Down

0 comments on commit b44dcc8

Please sign in to comment.