Skip to content

Commit cc48a17

Browse files
staabmondrejmirtes
authored andcommitted
Fix PHP 8.5 build errors
1 parent f581144 commit cc48a17

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

tests/PHPStan/Analyser/nsrt/pipe-operator.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ public function doBaz(): void
5858
assertType('int<1, max>', $x);
5959
};
6060

61-
doFoo() |> fn ($x) => assertType('int<1, max>', $x);
61+
doFoo() |> (fn ($x) => assertType('int<1, max>', $x));
6262

6363
doFoo() |> function (int $x) {
6464
assertType('int<1, max>', $x);
6565
};
6666

67-
doFoo() |> fn (int $x) => assertType('int<1, max>', $x);
67+
doFoo() |> (fn (int $x) => assertType('int<1, max>', $x));
6868
}
6969

7070
public function doBaz2(): void
@@ -144,16 +144,16 @@ public function doArrayFilter(array $ints): void
144144
return true;
145145
});
146146
});
147-
assertType('array<int<1, max>>', $ints |> fn ($x) => array_filter($x, function ($i) {
147+
assertType('array<int<1, max>>', $ints |> (fn ($x) => array_filter($x, function ($i) {
148148
assertType('int<1, max>', $i);
149149

150150
return true;
151-
}));
152-
assertType('array<int<1, max>>', $ints |> fn (array $x) => array_filter($x, function (int $i) {
151+
})));
152+
assertType('array<int<1, max>>', $ints |> (fn (array $x) => array_filter($x, function (int $i) {
153153
assertType('int<1, max>', $i);
154154

155155
return true;
156-
}));
156+
})));
157157
assertType('array<0|1|2, 1|2|3>', (function (array $x) {
158158
assertType('array{1, 2, 3}', $x);
159159
return array_filter($x, function (int $i) {
@@ -220,8 +220,8 @@ public function testConditional(): void
220220
assertType('null', null |> $this->doConditional(...));
221221
assertType('int', 'foo' |> $this->doConditional(...));
222222

223-
assertType('null', null |> fn($x) => $this->doConditional($x));
224-
assertType('int', 'foo' |> fn($x) => $this->doConditional($x));
223+
assertType('null', null |> (fn($x) => $this->doConditional($x)));
224+
assertType('int', 'foo' |> (fn($x) => $this->doConditional($x)));
225225
}
226226

227227
/**
@@ -239,8 +239,8 @@ public function testGenerics(): void
239239
assertType(stdClass::class, new stdClass() |> $this->doGenerics(...));
240240
assertType(stdClass::class, new stdClass() |> $this->doGenerics(...));
241241

242-
assertType(stdClass::class, new stdClass() |> fn($x) => $this->doGenerics($x));
243-
assertType(stdClass::class, new stdClass() |> fn($x) => $this->doGenerics($x));
242+
assertType(stdClass::class, new stdClass() |> (fn($x) => $this->doGenerics($x)));
243+
assertType(stdClass::class, new stdClass() |> (fn($x) => $this->doGenerics($x)));
244244

245245
assertType('null', null |> $this->doConditional(...) |> $this->doGenerics(...));
246246
assertType('int', 'foo' |> $this->doConditional(...) |> $this->doGenerics(...));

tests/PHPStan/Rules/Functions/data/function-call-statement-result-discarded.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function canDiscard(int $i): int
6363
(void) 5 |> withSideEffects(...);
6464
(void) 5 |> canDiscard(...);
6565

66-
5 |> fn ($x) => withSideEffects($x);
67-
5 |> fn ($x) => canDiscard($x);
68-
(void) 5 |> fn ($x) => withSideEffects($x);
69-
(void) 5 |> fn ($x) => canDiscard($x);
66+
5 |> (fn ($x) => withSideEffects($x));
67+
5 |> (fn ($x) => canDiscard($x));
68+
(void) 5 |> (fn ($x) => withSideEffects($x));
69+
(void) 5 |> (fn ($x) => canDiscard($x));

tests/PHPStan/Rules/Methods/data/method-call-statement-result-discarded.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function canDiscard(): array {
4949
(void) 5 |> $o->instanceMethod(...);
5050
(void) 5 |> $foo->canDiscard(...);
5151

52-
5 |> fn ($x) => $o->instanceMethod($x);
53-
5 |> fn ($x) => $foo->canDiscard($x);
54-
(void) 5 |> fn ($x) => $o->instanceMethod($x);
55-
(void) 5 |> fn ($x) => $foo->canDiscard($x);
52+
5 |> (fn ($x) => $o->instanceMethod($x));
53+
5 |> (fn ($x) => $foo->canDiscard($x));
54+
(void) 5 |> (fn ($x) => $o->instanceMethod($x));
55+
(void) 5 |> (fn ($x) => $foo->canDiscard($x));

tests/PHPStan/Rules/Methods/data/static-method-call-statement-result-discarded.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static function canDiscard(): array {
4545
(void) 5 |> ClassWithStaticSideEffects::staticMethod(...);
4646
(void) 5 |> Foo::canDiscard(...);
4747

48-
5 |> fn ($x) => ClassWithStaticSideEffects::staticMethod($x);
49-
5 |> fn ($x) => Foo::canDiscard($x);
50-
(void) 5 |> fn ($x) => ClassWithStaticSideEffects::staticMethod($x);
51-
(void) 5 |> fn ($x) => Foo::canDiscard($x);
48+
5 |> (fn ($x) => ClassWithStaticSideEffects::staticMethod($x));
49+
5 |> (fn ($x) => Foo::canDiscard($x));
50+
(void) 5 |> (fn ($x) => ClassWithStaticSideEffects::staticMethod($x));
51+
(void) 5 |> (fn ($x) => Foo::canDiscard($x));

0 commit comments

Comments
 (0)