Skip to content

Commit 391fd90

Browse files
authored
Merge pull request #525 from phpmetrics/php84-standalone
2 parents d06016f + 18ebd6e commit 391fd90

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

tests/Metric/Class_/Coupling/ExternalsVisitorTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testDependenciesAreFound($example, $classname, $expected): void
4141

4242
public static function provideExamples()
4343
{
44-
return [
44+
$cases = [
4545
[ __DIR__ . '/../../examples/externals1.php', 'A', ['H', 'C', 'B', 'D']],
4646
[ __DIR__ . '/../../examples/externals1.php', 'B', []],
4747
[ __DIR__ . '/../../examples/externals1.php', 'C', []],
@@ -52,6 +52,13 @@ public static function provideExamples()
5252
[ __DIR__ . '/../../examples/externals1.php', 'H', []],
5353
[ __DIR__ . '/../../examples/externals1.php', 'NS1\\A', ['NS2\\B']],
5454
];
55+
56+
// at least php 8.4:
57+
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
58+
$cases[] = [ __DIR__ . '/../../examples/php8.4.dereferencing_new.php', 'A', ['NS1\\B']];
59+
}
60+
61+
return $cases;
5562
}
5663

5764

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace {
3+
class A {
4+
public function foo()
5+
{
6+
new \NS1\B()->foo();
7+
}
8+
}
9+
}
10+
11+
namespace NS1 {
12+
class B {
13+
public function foo()
14+
{
15+
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)