Skip to content

Commit da259bd

Browse files
authored
Upgrade Dead Code Detector to 1.0.0 (#5430)
1 parent 50723e6 commit da259bd

File tree

6 files changed

+45
-24
lines changed

6 files changed

+45
-24
lines changed

build/ignore-by-php-version.neon.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
}
99
if (PHP_VERSION_ID >= 80100) {
1010
$includes[] = __DIR__ . '/baseline-8.1.neon';
11+
$includes[] = __DIR__ . '/../vendor/shipmonk/dead-code-detector/rules.neon';
1112
} else {
1213
$includes[] = __DIR__ . '/enums.neon';
1314
$includes[] = __DIR__ . '/readonly-property.neon';

build/phpstan.neon

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ includes:
44
- ../vendor/phpstan/phpstan-phpunit/extension.neon
55
- ../vendor/phpstan/phpstan-phpunit/rules.neon
66
- ../vendor/phpstan/phpstan-strict-rules/rules.neon
7-
- ../vendor/shipmonk/dead-code-detector/rules.neon
87
- ../conf/bleedingEdge.neon
98
- ../phpstan-baseline.neon
109
- ../phpstan-baseline.php
@@ -81,16 +80,27 @@ parameters:
8180
-
8281
identifier: shipmonk.deadMethod
8382
message: '#^Unused .*?Factory::create#' # likely used in DIC
83+
reportUnmatched: false
84+
-
85+
identifier: shipmonk.deadMethod
86+
message: '#^Unused PHPStan\\DependencyInjection\\BleedingEdgeToggle::isBleedingEdge#' # kept for future use
87+
reportUnmatched: false
8488
-
8589
identifier: shipmonk.deadMethod
8690
paths:
8791
- ../tests/PHPStan/Tests
8892
- ../tests/e2e
93+
reportUnmatched: false
8994
-
9095
identifier: shipmonk.deadConstant
9196
paths:
9297
- ../tests/PHPStan/Fixture
9398
reportUnmatched: false # constants on enums, not reported on PHP8-
99+
-
100+
identifier: shipmonk.deadEnumCase
101+
paths:
102+
- ../tests/PHPStan/Fixture
103+
reportUnmatched: false # enum cases, not reported on PHP8-
94104
-
95105
message: '''
96106
#^Access to constant on deprecated class DeprecatedAnnotations\\DeprecatedFoo\:
@@ -120,6 +130,9 @@ parameters:
120130
identifier: shipmonk.deadMethod
121131
path: ../src/Internal/CombinationsHelper.php
122132
reportUnmatched: false
133+
-
134+
rawMessage: 'Property PHPStan\Command\CommandHelper::$reservedMemory is never read' # intentional
135+
reportUnmatched: false
123136
reportStaticMethodSignatures: true
124137
tmpDir: %rootDir%/tmp
125138
stubFiles:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"phpstan/phpstan-strict-rules": "^2.0",
7474
"phpunit/phpunit": "^11.5.23",
7575
"shipmonk/composer-dependency-analyser": "^1.5",
76-
"shipmonk/dead-code-detector": "^0.14.0",
76+
"shipmonk/dead-code-detector": "^1.0.0",
7777
"shipmonk/name-collision-detector": "^2.0"
7878
},
7979
"config": {

composer.lock

Lines changed: 27 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DependencyInjection/BleedingEdgeToggle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ final class BleedingEdgeToggle
77

88
private static bool $bleedingEdge = false;
99

10-
public static function isBleedingEdge(): bool // @phpstan-ignore shipmonk.deadMethod (kept for future use)
10+
public static function isBleedingEdge(): bool
1111
{
1212
return self::$bleedingEdge;
1313
}

src/Internal/DirectoryCreatorException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
final class DirectoryCreatorException extends Exception
1111
{
1212

13-
public function __construct(public readonly string $directory)
13+
public function __construct(string $directory)
1414
{
1515
$error = error_get_last();
1616

0 commit comments

Comments
 (0)