Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ App\User\Entity\Address::__construct

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.

> [!TIP]
> You can change the list of debug references without affecting result cache, so rerun is instant!

## Future scope:
- Dead class property detection
- Dead class detection
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"php": "^7.4 || ^8.0",
"phpstan/phpstan": "^2.1.7"
"phpstan/phpstan": "^2.1.9"
},
"require-dev": {
"composer-runtime-api": "^2.0",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ services:


parameters:
parametersNotInvalidatingCache:
- parameters.shipmonkDeadCode.debug.usagesOf
- parameters.shipmonkDeadCode.reportTransitivelyDeadMethodAsSeparateError
shipmonkDeadCode:
trackMixedAccess: null
reportTransitivelyDeadMethodAsSeparateError: false
Expand Down
4 changes: 2 additions & 2 deletions src/Provider/ReflectionUsageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function extractConstantsUsedByReflection(
}

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

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

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

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