Skip to content

Commit

Permalink
Avoid PHP 8.4 deprecation warnings (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati authored Oct 29, 2024
1 parent 125ab84 commit 08bb43b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
include:
- os: windows-latest
php-version: "5.5"
Expand Down
12 changes: 6 additions & 6 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,20 @@ public static function getRangesFromBoundaries($from, $to, $flags = 0)
}

/**
* @param \IPLib\Address\AddressInterface $from
* @param \IPLib\Address\AddressInterface $to
* @param \IPLib\Address\AddressInterface|null $from
* @param \IPLib\Address\AddressInterface|null $to
*
* @return \IPLib\Range\RangeInterface|null
*
* @since 1.2.0
*/
protected static function rangeFromBoundaryAddresses(AddressInterface $from = null, AddressInterface $to = null)
protected static function rangeFromBoundaryAddresses($from = null, $to = null)
{
if ($from === null && $to === null) {
if (!$from instanceof AddressInterface && !$to instanceof AddressInterface) {
$result = null;
} elseif ($to === null) {
} elseif (!$to instanceof AddressInterface) {
$result = Range\Single::fromAddress($from);
} elseif ($from === null) {
} elseif (!$from instanceof AddressInterface) {
$result = Range\Single::fromAddress($to);
} else {
$result = null;
Expand Down
3 changes: 2 additions & 1 deletion test/tests/Addresses/NonDecimalIPv4AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ public function casesProvider()
*
* @param string $input
* @param bool $parseNonDecimal
* @param array|null $expected
*/
public function testCases($input, $parseNonDecimal, array $expected = null)
public function testCases($input, $parseNonDecimal, $expected = null)
{
$ip = Factory::addressFromString($input, true, true, $parseNonDecimal);
if ($expected === null) {
Expand Down
2 changes: 1 addition & 1 deletion test/tests/Services/UnsignedIntegerMathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function provideCases()
* @param int[]|null $expectedResult
* @param bool $onlyDecimal
*/
public function testGetBytes($value, $numBytes, array $expectedResult = null, $onlyDecimal = false)
public function testGetBytes($value, $numBytes, $expectedResult = null, $onlyDecimal = false)
{
$maxSignedIntegers = PHP_INT_SIZE === 4 ? array(null) : array(null, 0x7FFFFFFF);
foreach ($maxSignedIntegers as $maxSignedInteger) {
Expand Down

0 comments on commit 08bb43b

Please sign in to comment.