Skip to content

Commit 0e08d16

Browse files
authored
Remove unnecessary PHP version checks (#996)
1 parent 400ef7a commit 0e08d16

File tree

5 files changed

+39
-69
lines changed

5 files changed

+39
-69
lines changed

.dev-tools/phpstan.neon

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ parameters:
1212
count: 1
1313
path: ../src/Analyzer/Analysis/ConstructorAnalysis.php
1414

15-
-
16-
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70400 is always true\.$#'
17-
identifier: greaterOrEqual.alwaysTrue
18-
count: 1
19-
path: ../src/Fixer/NumericLiteralSeparatorFixer.php
20-
2115
-
2216
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 80000 is always true\.$#'
2317
identifier: greaterOrEqual.alwaysTrue
@@ -30,12 +24,6 @@ parameters:
3024
count: 1
3125
path: ../src/Fixer/StringableInterfaceFixer.php
3226

33-
-
34-
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70300 is always true\.$#'
35-
identifier: greaterOrEqual.alwaysTrue
36-
count: 1
37-
path: ../tests/Analyzer/FunctionAnalyzerTest.php
38-
3927
-
4028
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
4129
identifier: argument.type
@@ -60,18 +48,6 @@ parameters:
6048
count: 1
6149
path: ../tests/Fixer/AbstractFixerTestCase.php
6250

63-
-
64-
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70300 is always true\.$#'
65-
identifier: greaterOrEqual.alwaysTrue
66-
count: 1
67-
path: ../tests/Fixer/NoUselessDirnameCallFixerTest.php
68-
69-
-
70-
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70400 is always true\.$#'
71-
identifier: greaterOrEqual.alwaysTrue
72-
count: 1
73-
path: ../tests/Fixer/PhpdocNoIncorrectVarAnnotationFixerTest.php
74-
7551
-
7652
message: '#^Method Tests\\FixersTest\:\:fixerNamesFromCollection\(\) should return array\<int, string\> but returns array\<string\>\.$#'
7753
identifier: return.type

src/Fixer/NumericLiteralSeparatorFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getPriority(): int
104104

105105
public function isCandidate(Tokens $tokens): bool
106106
{
107-
return \PHP_VERSION_ID >= 70400 && $tokens->isAnyTokenKindsFound([\T_DNUMBER, \T_LNUMBER]);
107+
return $tokens->isAnyTokenKindsFound([\T_DNUMBER, \T_LNUMBER]);
108108
}
109109

110110
public function isRisky(): bool

tests/Analyzer/FunctionAnalyzerTest.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,20 @@ public static function provideGettingArgumentsCases(): iterable
137137
1,
138138
];
139139

140-
if (\PHP_VERSION_ID >= 70300) {
141-
yield 'argument with trailing comma' => [
142-
[new ArgumentAnalysis(3, 3, false)],
143-
'<?php foo($x);',
144-
1,
145-
];
146-
147-
yield 'multiple arguments with trailing comma' => [
148-
[
149-
new ArgumentAnalysis(3, 3, true),
150-
new ArgumentAnalysis(6, 6, true),
151-
new ArgumentAnalysis(9, 9, true),
152-
],
153-
'<?php foo(1, 2, 3,);',
154-
1,
155-
];
156-
}
140+
yield 'argument with trailing comma' => [
141+
[new ArgumentAnalysis(3, 3, false)],
142+
'<?php foo($x);',
143+
1,
144+
];
145+
146+
yield 'multiple arguments with trailing comma' => [
147+
[
148+
new ArgumentAnalysis(3, 3, true),
149+
new ArgumentAnalysis(6, 6, true),
150+
new ArgumentAnalysis(9, 9, true),
151+
],
152+
'<?php foo(1, 2, 3,);',
153+
1,
154+
];
157155
}
158156
}

tests/Fixer/NoUselessDirnameCallFixerTest.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,14 @@ public static function provideFixCases(): iterable
8888
];
8989

9090
// test with trailing comma
91-
if (\PHP_VERSION_ID >= 70300) {
92-
yield [
93-
'<?php __DIR__ . "/../path";',
94-
'<?php dirname(__DIR__,) . "/path";',
95-
];
91+
yield [
92+
'<?php __DIR__ . "/../path";',
93+
'<?php dirname(__DIR__,) . "/path";',
94+
];
9695

97-
yield [
98-
'<?php __DIR__ . "/../../../path";',
99-
'<?php \\dirname(__DIR__,3,) . "/path";',
100-
];
101-
}
96+
yield [
97+
'<?php __DIR__ . "/../../../path";',
98+
'<?php \\dirname(__DIR__,3,) . "/path";',
99+
];
102100
}
103101
}

tests/Fixer/PhpdocNoIncorrectVarAnnotationFixerTest.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -237,27 +237,25 @@ class Foo
237237
',
238238
];
239239

240-
if (\PHP_VERSION_ID >= 70400) {
241-
yield 'keep correct PHPDoc for class properties, PHP 7.4' => [
242-
'<?php class Foo
243-
{
244-
/** @var array */
245-
private array $array;
240+
yield 'keep correct PHPDoc for class properties, PHP 7.4' => [
241+
'<?php class Foo
242+
{
243+
/** @var array */
244+
private array $array;
246245
247-
/** @var bool */
248-
private bool $boolean;
246+
/** @var bool */
247+
private bool $boolean;
249248
250-
/** @var null|string */
251-
private ?string $nullableString;
249+
/** @var null|string */
250+
private ?string $nullableString;
252251
253-
/** @var Bar */
254-
private Bar $bar;
252+
/** @var Bar */
253+
private Bar $bar;
255254
256-
/** @var Vendor\\Baz */
257-
private Vendor\\Baz $baz;
258-
}',
259-
];
260-
}
255+
/** @var Vendor\\Baz */
256+
private Vendor\\Baz $baz;
257+
}',
258+
];
261259

262260
yield 'remove PHPDoc for class properties' => [
263261
'<?php

0 commit comments

Comments
 (0)