Skip to content

Commit dfcd496

Browse files
committed
support for PHP 8.5
1 parent 0b21bc8 commit dfcd496

File tree

7 files changed

+26
-15
lines changed

7 files changed

+26
-15
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: ['8.1', '8.2', '8.3', '8.4']
10+
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
1111

1212
fail-fast: false
1313

src/Application/UI/ComponentReflection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getParameters(): array
4949
|| $prop->getAttributes(Attributes\Persistent::class)
5050
) {
5151
$params[$prop->getName()] = [
52-
'def' => $prop->getDefaultValue(),
52+
'def' => $prop->hasDefaultValue() ? $prop->getDefaultValue() : null,
5353
'type' => ParameterConverter::getType($prop),
5454
'since' => $isPresenter ? Reflection::getPropertyDeclaringClass($prop)->getName() : null,
5555
];

src/Bridges/ApplicationLatte/SnippetRuntime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function enter(string $name, string $type): void
5656
($this->nestingLevel === 0 && $this->control->isControlInvalid($name))
5757
|| ($type === self::TypeDynamic && ($previous = end($this->stack)) && $previous[1] === true)
5858
) {
59-
ob_start(fn() => null);
59+
ob_start(fn() => '');
6060
$this->nestingLevel = $type === self::TypeArea ? 0 : 1;
6161
$obStarted = true;
6262
} elseif ($this->nestingLevel > 0) {

src/Bridges/ApplicationLatte/Template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function blueprint(?string $parentClass = null): void
153153
/**
154154
* Prevents unserialization.
155155
*/
156-
final public function __wakeup()
156+
final public function __unserialize($_)
157157
{
158158
throw new Nette\NotImplementedException('Object unserialization is not supported by class ' . static::class);
159159
}

tests/Bridges.DI/RoutingExtension.cache.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MyRouter implements Nette\Routing\Router
3030
}
3131

3232

33-
public function __wakeup()
33+
public function __unserialize($_)
3434
{
3535
$this->woken = true;
3636
}

tests/Routers/Route.filter.global.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require __DIR__ . '/Route.php';
1616

1717

1818
$route = new Route('<presenter>', [
19-
null => [
19+
'' => [
2020
Route::FilterIn => function (array $arr) {
2121
if (substr($arr['presenter'], 0, 3) !== 'Abc') {
2222
return null;
@@ -50,7 +50,7 @@ Assert::null(testRouteOut($route, ['presenter' => 'Cde']));
5050

5151

5252
$route = new Route('<lang>/<presenter>/<action>', [
53-
null => [
53+
'' => [
5454
Route::FilterIn => function (array $arr) {
5555
if ($arr['presenter'] !== 'AbcCs') {
5656
return null;

tests/UI/Presenter.link().persistent.phpt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ use Tester\Assert;
1414
require __DIR__ . '/../bootstrap.php';
1515

1616

17+
function sortParams(array $params): array
18+
{
19+
ksort($params);
20+
return $params;
21+
}
22+
23+
1724
trait PersistentParam1
1825
{
1926
/** @persistent */
@@ -62,9 +69,13 @@ class TestPresenter extends BasePresenter
6269
$this->p2 = 2;
6370
$this->t1 = 3;
6471
$this->t2 = 4;
65-
Assert::same('/index.php?p2=2&p1=1&t1=3&t2=4&action=default&presenter=Test', $this->link('this'));
72+
Assert::same(PHP_VERSION_ID < 80500
73+
? '/index.php?p2=2&p1=1&t1=3&t2=4&action=default&presenter=Test'
74+
: '/index.php?p2=2&t2=4&p1=1&t1=3&action=default&presenter=Test', $this->link('this'));
6675
Assert::same('/index.php?p1=1&t1=3&action=default&presenter=Second', $this->link('Second:'));
67-
Assert::same('/index.php?p1=1&t1=3&t2=4&action=default&presenter=Third', $this->link('Third:'));
76+
Assert::same(PHP_VERSION_ID < 80500
77+
? '/index.php?p1=1&t1=3&t2=4&action=default&presenter=Third'
78+
: '/index.php?t2=4&p1=1&t1=3&action=default&presenter=Third', $this->link('Third:'));
6879

6980
$this->p1 = 20;
7081
Assert::same('/index.php?t1=3&action=default&presenter=Second', $this->link('Second:'));
@@ -105,32 +116,32 @@ class FourthPresenter extends BasePresenter
105116
Assert::same([
106117
'p1' => ['def' => null, 'type' => 'scalar', 'since' => 'BasePresenter'],
107118
't1' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam1'],
108-
], BasePresenter::getReflection()->getPersistentParams());
119+
], sortParams(BasePresenter::getReflection()->getPersistentParams()));
109120

110121
Assert::same([
111-
'p2' => ['def' => null, 'type' => 'scalar', 'since' => 'TestPresenter'],
112122
'p1' => ['def' => null, 'type' => 'scalar', 'since' => 'BasePresenter'],
123+
'p2' => ['def' => null, 'type' => 'scalar', 'since' => 'TestPresenter'],
113124
't1' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam1'],
114125
't2' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam2A'],
115-
], TestPresenter::getReflection()->getPersistentParams());
126+
], sortParams(TestPresenter::getReflection()->getPersistentParams()));
116127

117128
Assert::same([
118129
'p1' => ['def' => 20, 'type' => 'int', 'since' => 'BasePresenter'],
119130
'p3' => ['def' => null, 'type' => 'scalar', 'since' => 'SecondPresenter'],
120131
't1' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam1'],
121132
't3' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam3'],
122-
], SecondPresenter::getReflection()->getPersistentParams());
133+
], sortParams(SecondPresenter::getReflection()->getPersistentParams()));
123134

124135
Assert::same([
125136
'p1' => ['def' => null, 'type' => 'scalar', 'since' => 'BasePresenter'],
126137
't1' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam1'],
127138
't2' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam2A'],
128-
], ThirdPresenter::getReflection()->getPersistentParams());
139+
], sortParams(ThirdPresenter::getReflection()->getPersistentParams()));
129140

130141
Assert::same([
131142
'p1' => ['def' => null, 'type' => 'scalar', 'since' => 'BasePresenter'],
132143
't1' => ['def' => null, 'type' => 'scalar', 'since' => 'PersistentParam1'],
133-
], FourthPresenter::getReflection()->getPersistentParams());
144+
], sortParams(FourthPresenter::getReflection()->getPersistentParams()));
134145

135146
$url = new Http\UrlScript('http://localhost/index.php', '/index.php');
136147

0 commit comments

Comments
 (0)