Skip to content

Commit fa736ff

Browse files
committed
get rid of match expression in dataprovider entry since it won't be transpiled
1 parent 032ae7d commit fa736ff

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5138,6 +5138,14 @@ public function testArrayFunctions(
51385138

51395139
public function dataFunctions(): array
51405140
{
5141+
$strSplitDefaultReturnType = 'non-empty-array<int, string>|false';
5142+
if (PHP_VERSION_ID >= 80000) {
5143+
$strSplitDefaultReturnType = 'non-empty-array<int, string>';
5144+
}
5145+
if (PHP_VERSION_ID >= 80200) {
5146+
$strSplitDefaultReturnType = 'array<int, string>';
5147+
}
5148+
51415149
return [
51425150
[
51435151
'string',
@@ -5328,11 +5336,7 @@ public function dataFunctions(): array
53285336
'$gettimeofdayBenevolent',
53295337
],
53305338
[
5331-
match (true) {
5332-
PHP_VERSION_ID >= 80200 => 'array<int, string>',
5333-
PHP_VERSION_ID >= 80000 => 'non-empty-array<int, string>',
5334-
default => 'non-empty-array<int, string>|false',
5335-
},
5339+
$strSplitDefaultReturnType,
53365340
'$strSplitConstantStringWithoutDefinedParameters',
53375341
],
53385342
[
@@ -5356,23 +5360,15 @@ public function dataFunctions(): array
53565360
'$strSplitConstantStringWithFailureSplitLength',
53575361
],
53585362
[
5359-
match (true) {
5360-
PHP_VERSION_ID >= 80200 => 'array<int, string>',
5361-
PHP_VERSION_ID >= 80000 => 'non-empty-array<int, string>',
5362-
default => 'non-empty-array<int, string>|false',
5363-
},
5363+
$strSplitDefaultReturnType,
53645364
'$strSplitConstantStringWithInvalidSplitLengthType',
53655365
],
53665366
[
53675367
'array{\'a\'|\'g\', \'b\'|\'h\', \'c\'|\'i\', \'d\'|\'j\', \'e\'|\'k\', \'f\'|\'l\'}',
53685368
'$strSplitConstantStringWithVariableStringAndConstantSplitLength',
53695369
],
53705370
[
5371-
match (true) {
5372-
PHP_VERSION_ID >= 80200 => 'array<int, string>',
5373-
PHP_VERSION_ID >= 80000 => 'non-empty-array<int, string>',
5374-
default => 'non-empty-array<int, string>|false',
5375-
},
5371+
$strSplitDefaultReturnType,
53765372
'$strSplitConstantStringWithVariableStringAndVariableSplitLength',
53775373
],
53785374
// parse_url

0 commit comments

Comments
 (0)