Skip to content

Commit 3f96b1c

Browse files
authored
Dead Code Detector 0.10 (#85)
1 parent f7a6d6e commit 3f96b1c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"phpstan/phpstan-strict-rules": "^2.0.0",
1919
"phpunit/phpunit": "^10.5",
2020
"shipmonk/composer-dependency-analyser": "^1.8.1",
21-
"shipmonk/dead-code-detector": "^0.9.2",
21+
"shipmonk/dead-code-detector": "^0.10.0",
2222
"shipmonk/name-collision-detector": "^2.1.1",
2323
"shipmonk/phpstan-rules": "^4.0.0",
2424
"slevomat/coding-standard": "dev-master"

src-dev/PHPStan/IgnoreDeadInterfaceUsageProvider.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44

55
use ReflectionMethod;
66
use ShipMonk\PHPStan\DeadCode\Provider\ReflectionBasedMemberUsageProvider;
7+
use ShipMonk\PHPStan\DeadCode\Provider\VirtualUsageData;
78

89
class IgnoreDeadInterfaceUsageProvider extends ReflectionBasedMemberUsageProvider
910
{
1011

11-
public function shouldMarkMethodAsUsed(ReflectionMethod $method): bool
12+
public function shouldMarkMethodAsUsed(ReflectionMethod $method): ?VirtualUsageData
1213
{
13-
return $method->getDeclaringClass()->isInterface() || $method->isAbstract();
14+
if ($method->getDeclaringClass()->isInterface() || $method->isAbstract()) {
15+
return VirtualUsageData::withNote('interface methods kept for unification');
16+
}
17+
18+
return null;
1419
}
1520

1621
}

0 commit comments

Comments
 (0)