Skip to content

Commit 3d3c723

Browse files
committed
Build fixes
1 parent cccb9f3 commit 3d3c723

File tree

2 files changed

+53
-38
lines changed

2 files changed

+53
-38
lines changed

tests/PHPStan/Reflection/ParametersAcceptorSelectorTest.php

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ public function dataSelectFromTypes(): \Generator
4242
$arrayRandVariants[0],
4343
];
4444

45-
yield [
46-
[
47-
new ArrayType(new MixedType(), new MixedType()),
48-
],
49-
$arrayRandVariants,
50-
false,
51-
$arrayRandVariants[1],
52-
];
45+
if (PHP_VERSION_ID < 80000) {
46+
yield [
47+
[
48+
new ArrayType(new MixedType(), new MixedType()),
49+
],
50+
$arrayRandVariants,
51+
false,
52+
$arrayRandVariants[1],
53+
];
54+
}
5355

5456
$datePeriodConstructorVariants = $broker->getClass('DatePeriod')->getNativeMethod('__construct')->getVariants();
5557
yield [
@@ -63,26 +65,29 @@ public function dataSelectFromTypes(): \Generator
6365
false,
6466
$datePeriodConstructorVariants[0],
6567
];
66-
yield [
67-
[
68-
new ObjectType(\DateTimeInterface::class),
69-
new ObjectType(\DateInterval::class),
70-
new ObjectType(\DateTimeInterface::class),
71-
new IntegerType(),
72-
],
73-
$datePeriodConstructorVariants,
74-
false,
75-
$datePeriodConstructorVariants[1],
76-
];
77-
yield [
78-
[
79-
new StringType(),
80-
new IntegerType(),
81-
],
82-
$datePeriodConstructorVariants,
83-
false,
84-
$datePeriodConstructorVariants[2],
85-
];
68+
69+
if (PHP_VERSION_ID < 80000) {
70+
yield [
71+
[
72+
new ObjectType(\DateTimeInterface::class),
73+
new ObjectType(\DateInterval::class),
74+
new ObjectType(\DateTimeInterface::class),
75+
new IntegerType(),
76+
],
77+
$datePeriodConstructorVariants,
78+
false,
79+
$datePeriodConstructorVariants[1],
80+
];
81+
yield [
82+
[
83+
new StringType(),
84+
new IntegerType(),
85+
],
86+
$datePeriodConstructorVariants,
87+
false,
88+
$datePeriodConstructorVariants[2],
89+
];
90+
}
8691

8792
$ibaseWaitEventVariants = $broker->getFunction(new Name('ibase_wait_event'), null)->getVariants();
8893
yield [
@@ -196,14 +201,17 @@ public function dataSelectFromTypes(): \Generator
196201
new UnionType([new StringType(), new ConstantBooleanType(false)])
197202
),
198203
];
199-
yield [
200-
[
201-
new StringType(),
202-
],
203-
$strtokVariants,
204-
true,
205-
ParametersAcceptorSelector::combineAcceptors($strtokVariants),
206-
];
204+
205+
if (PHP_VERSION_ID < 80000) {
206+
yield [
207+
[
208+
new StringType(),
209+
],
210+
$strtokVariants,
211+
true,
212+
ParametersAcceptorSelector::combineAcceptors($strtokVariants),
213+
];
214+
}
207215

208216
$variadicVariants = [
209217
new FunctionVariant(

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public function testImplodeOnPhp74(): void
315315
} elseif (PHP_VERSION_ID >= 80000) {
316316
$errors = [
317317
[
318-
'Parameter #2 $pieces of function implode expects array, string given.',
318+
'Parameter #2 $array of function implode expects array, string given.',
319319
8,
320320
],
321321
];
@@ -331,7 +331,7 @@ public function testImplodeOnLessThanPhp74(): void
331331
}
332332

333333
$errors = [];
334-
if (PHP_VERSION_ID >= 70400) {
334+
if (PHP_VERSION_ID >= 70400 && PHP_VERSION_ID < 80000) {
335335
$errors = [
336336
[
337337
'Parameter #1 $glue of function implode expects string, array given.',
@@ -342,6 +342,13 @@ public function testImplodeOnLessThanPhp74(): void
342342
8,
343343
],
344344
];
345+
} elseif (PHP_VERSION_ID >= 80000) {
346+
$errors = [
347+
[
348+
'Parameter #2 $array of function implode expects array, string given.',
349+
8,
350+
],
351+
];
345352
}
346353

347354
$this->analyse([__DIR__ . '/data/implode-74.php'], $errors);

0 commit comments

Comments
 (0)