Skip to content

Commit bb8ce95

Browse files
committed
support for PHP 8.1
1 parent 3122e00 commit bb8ce95

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php: ['7.2', '7.3', '7.4', '8.0']
10+
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
1111

1212
fail-fast: false
1313

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",
18+
"php": ">=7.2 <8.2",
1919
"nette/utils": "^3.1.2"
2020
},
2121
"require-dev": {

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Installation
3333
composer require nette/php-generator
3434
```
3535

36-
- PhpGenerator 3.6 is compatible with PHP 7.2 to 8.0
36+
- PhpGenerator 3.6 is compatible with PHP 7.2 to 8.1
3737
- PhpGenerator 3.2 – 3.5 is compatible with PHP 7.1 to 8.0
3838
- PhpGenerator 3.1 is compatible with PHP 7.1 to 7.3
3939
- PhpGenerator 3.0 is compatible with PHP 7.0 to 7.3

tests/PhpGenerator/Dumper.dump().phpt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ class Test2 extends Test
110110
}
111111

112112
Assert::same(
113-
"\\Nette\\PhpGenerator\\Dumper::createObject('Test2', [\n\t\"\\x00Test2\\x00c\" => 4,\n\t'a' => 1,\n\t\"\\x00*\\x00b\" => 2,\n])",
113+
PHP_VERSION_ID < 80100
114+
? "\\Nette\\PhpGenerator\\Dumper::createObject('Test2', [\n\t\"\\x00Test2\\x00c\" => 4,\n\t'a' => 1,\n\t\"\\x00*\\x00b\" => 2,\n])"
115+
: "\\Nette\\PhpGenerator\\Dumper::createObject('Test2', [\n\t'a' => 1,\n\t\"\\x00*\\x00b\" => 2,\n\t\"\\x00Test2\\x00c\" => 4,\n])",
114116
$dumper->dump(new Test2)
115117
);
116118
Assert::equal(new Test2, eval('return ' . $dumper->dump(new Test2) . ';'));
@@ -133,24 +135,26 @@ Assert::exception(function () {
133135

134136

135137
// serializable
136-
class Test3 implements Serializable
137-
{
138-
private $a;
138+
if (PHP_VERSION_ID < 80100) {
139+
class Test3 implements Serializable
140+
{
141+
private $a;
139142

140143

141-
public function serialize()
142-
{
143-
return '';
144-
}
144+
public function serialize()
145+
{
146+
return '';
147+
}
145148

146149

147-
public function unserialize($s)
148-
{
150+
public function unserialize($s)
151+
{
152+
}
149153
}
150-
}
151154

152-
Assert::same('unserialize(\'C:5:"Test3":0:{}\')', $dumper->dump(new Test3));
153-
Assert::equal(new Test3, eval('return ' . $dumper->dump(new Test3) . ';'));
155+
Assert::same('unserialize(\'C:5:"Test3":0:{}\')', $dumper->dump(new Test3));
156+
Assert::equal(new Test3, eval('return ' . $dumper->dump(new Test3) . ';'));
157+
}
154158

155159

156160

0 commit comments

Comments
 (0)