Skip to content

Commit a4f65fa

Browse files
committed
Constants deprecation depends on Scope->getPhpVersion()
1 parent 7188c0b commit a4f65fa

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/Rules/Deprecations/FetchingDeprecatedConstRuleTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,21 @@ public function testFetchingDeprecatedConst(): void
5959
);
6060
}
6161

62+
public function testEstrictWithVersionGuard(): void
63+
{
64+
require_once __DIR__ . '/data/bug-162.php';
65+
$this->analyse(
66+
[__DIR__ . '/data/bug-162.php'],
67+
[
68+
[
69+
'Use of constant E_STRICT is deprecated.',
70+
7
71+
],
72+
[
73+
'Use of constant E_STRICT is deprecated.',
74+
18
75+
],
76+
],
77+
);
78+
}
6279
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Bug162;
4+
5+
function foo(int $errno):void {
6+
if (PHP_VERSION_ID >= 80400) {
7+
if (E_STRICT === $errno) {
8+
9+
}
10+
}
11+
12+
if (PHP_VERSION_ID < 80400) {
13+
if (E_STRICT === $errno) {
14+
15+
}
16+
}
17+
18+
if (E_STRICT === $errno ) {
19+
}
20+
}

0 commit comments

Comments
 (0)