Skip to content

Commit a10e5cb

Browse files
committed
support for PHP 8.1 [Closes #261]
1 parent 5c36cc1 commit a10e5cb

File tree

9 files changed

+12
-6
lines changed

9 files changed

+12
-6
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, windows-latest, macOS-latest]
11-
php: ['7.2', '7.3', '7.4', '8.0']
11+
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
1212

1313
fail-fast: false
1414

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=7.2 <8.1"
18+
"php": ">=7.2 <8.2"
1919
},
2020
"require-dev": {
2121
"nette/tester": "~2.0",

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The recommended way to install is via Composer:
3838
composer require nette/utils
3939
```
4040

41-
- Nette Utils 3.2 is compatible with PHP 7.2 to 8.0
41+
- Nette Utils 3.2 is compatible with PHP 7.2 to 8.1
4242
- Nette Utils 3.1 is compatible with PHP 7.1 to 8.0
4343
- Nette Utils 3.0 is compatible with PHP 7.1 to 8.0
4444
- Nette Utils 2.5 is compatible with PHP 5.6 to 8.0

src/Utils/ArrayHash.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function offsetSet($key, $value): void
6565
}
6666

6767

68+
#[\ReturnTypeWillChange]
6869
/**
6970
* Returns a item.
7071
* @param string|int $key

src/Utils/ArrayList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function offsetSet($index, $value): void
6161
}
6262

6363

64+
#[\ReturnTypeWillChange]
6465
/**
6566
* Returns a item.
6667
* @param int $index

src/Utils/DateTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public static function fromParts(
9090
}
9191

9292

93+
#[\ReturnTypeWillChange]
9394
/**
9495
* Returns new DateTime object formatted according to the specified format.
9596
* @param string $format The format the $time parameter should be in

src/Utils/Html.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ final public function offsetSet($index, $child): void
659659
}
660660

661661

662+
#[\ReturnTypeWillChange]
662663
/**
663664
* Returns child node (\ArrayAccess implementation).
664665
* @param int $index

tests/Utils/DateTime.from.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Assert::same('1978-01-23 11:40:00', (string) (new DateTime)->setTimestamp(254400
1919
Assert::same(254400000, DateTime::from(254400000)->getTimestamp());
2020

2121
Assert::same(time() + 60, (int) DateTime::from(60)->format('U'));
22-
Assert::same('2050-08-13 11:40:00', (string) DateTime::from(2544000000));
23-
Assert::same('2050-08-13 11:40:00', (string) (new DateTime)->setTimestamp(2544000000));
22+
Assert::same(PHP_VERSION_ID < 80100 ? '2050-08-13 11:40:00' : '2050-08-13 12:40:00', (string) DateTime::from(2544000000));
23+
Assert::same(PHP_VERSION_ID < 80100 ? '2050-08-13 11:40:00' : '2050-08-13 12:40:00', (string) (new DateTime)->setTimestamp(2544000000));
2424
Assert::same(is_int(2544000000) ? 2544000000 : '2544000000', DateTime::from(2544000000)->getTimestamp()); // 64 bit
2525

2626
Assert::same('1978-05-05 00:00:00', (string) DateTime::from('1978-05-05'));

tests/Utils/SmartObject.undeclaredMethod.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ Assert::exception(
128128
Nette\MemberAccessException::class,
129129
PHP_VERSION_ID < 70400
130130
? 'Call to private method InterClass::callPrivateParent() from scope ChildClass.'
131-
: 'Call to undefined static method InterClass::callPrivateParent().'
131+
: (PHP_VERSION_ID < 80100
132+
? 'Call to undefined static method InterClass::callPrivateParent().' // differs from native error message
133+
: 'Call to undefined method InterClass::callPrivateParent().')
132134
);
133135

134136
Assert::exception(function () {

0 commit comments

Comments
 (0)