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

fix(build): Deprecation issues in PHP 8.1 #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
branches:
only:
- master
Expand All @@ -16,4 +19,4 @@ script:
after_script:
- travis_retry vendor/bin/php-coveralls
# or enable logging
- travis_retry vendor/bin/php-coveralls -v
- travis_retry vendor/bin/php-coveralls -v
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"php" : ">=7.1"
},
"require-dev" : {
"phpunit/phpunit" : "^7.0",
"phpunit/phpunit" : "^9.0",
"php-coveralls/php-coveralls": "^2.1"
},
"autoload" : {
Expand Down
39 changes: 31 additions & 8 deletions src/ArrObj.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,35 +274,58 @@ public function setArray($array): self
return $this;
}

public function offsetExists($offset)
/**
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset): bool
{
return array_key_exists($offset, $this->array);
}

public function offsetGet($offset)
/**
* @param mixed $offset
* @return mixed|null
*/
#[\ReturnTypeWillChange] public function offsetGet($offset)
{
return $this->array[$offset] ?? null;
}

public function offsetSet($offset, $value)
/**
* @param mixed $offset
* @param mixed $value
* @return void
*/
public function offsetSet($offset, $value): void
{
return $this->array[$offset] = $value;
$this->array[$offset] = $value;
}

public function offsetUnset($offset)
/**
* @param mixed $offset
* @return void
*/
public function offsetUnset($offset): void
{
if (isset($this->array[$offset])) {
unset($this->array[$offset]);
}
}

public function getIterator()
/**
* @return ArrayIterator
*/
public function getIterator(): ArrayIterator
{
return new ArrayIterator($this->array);
}

public function count()
/**
* @return int
*/
public function count(): int
{
return count($this->array);
}
}
}
2 changes: 1 addition & 1 deletion tests/ArrObj/ArrObjTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ArrObjTest extends ArrTestCase
/** @var ArrObj */
private $obj;

public function setUp()
public function setUp(): void
{
$this->obj = new ArrObj();
}
Expand Down