Skip to content

Commit 63d47a6

Browse files
authored
Changing debug refs not to invalidate result cache (#169)
1 parent 1a94628 commit 63d47a6

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ App\User\Entity\Address::__construct
390390

391391
If you set up `editorUrl` [parameter](https://phpstan.org/user-guide/output-format#opening-file-in-an-editor), you can click on the usages to open it in your IDE.
392392

393+
> [!TIP]
394+
> You can change the list of debug references without affecting result cache, so rerun is instant!
395+
393396
## Future scope:
394397
- Dead class property detection
395398
- Dead class detection

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": "^7.4 || ^8.0",
16-
"phpstan/phpstan": "^2.1.7"
16+
"phpstan/phpstan": "^2.1.9"
1717
},
1818
"require-dev": {
1919
"composer-runtime-api": "^2.0",

composer.lock

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

rules.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ services:
121121

122122

123123
parameters:
124+
parametersNotInvalidatingCache:
125+
- parameters.shipmonkDeadCode.debug.usagesOf
126+
- parameters.shipmonkDeadCode.reportTransitivelyDeadMethodAsSeparateError
124127
shipmonkDeadCode:
125128
trackMixedAccess: null
126129
reportTransitivelyDeadMethodAsSeparateError: false

src/Provider/ReflectionUsageProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private function extractConstantsUsedByReflection(
107107
}
108108

109109
if (($methodName === 'getConstant' || $methodName === 'getReflectionConstant') && count($args) === 1) {
110-
$firstArg = $args[array_key_first($args)]; // @phpstan-ignore offsetAccess.notFound
110+
$firstArg = $args[array_key_first($args)];
111111

112112
foreach ($scope->getType($firstArg->value)->getConstantStrings() as $constantString) {
113113
$usedConstants[] = $this->createConstantUsage($node, $scope, $genericReflection->getName(), $constantString->getValue());
@@ -138,7 +138,7 @@ private function extractMethodsUsedByReflection(
138138
}
139139

140140
if ($methodName === 'getMethod' && count($args) === 1) {
141-
$firstArg = $args[array_key_first($args)]; // @phpstan-ignore offsetAccess.notFound
141+
$firstArg = $args[array_key_first($args)];
142142

143143
foreach ($scope->getType($firstArg->value)->getConstantStrings() as $constantString) {
144144
$usedMethods[] = $this->createMethodUsage($node, $scope, $genericReflection->getName(), $constantString->getValue());

0 commit comments

Comments
 (0)