diff --git a/README.md b/README.md index e3cf395..39fbdb6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ - โœ… **PHPStan** extension - โ™ป๏ธ **Dead cycles** detection -- ๐Ÿ”— **Transitive dead** method detection +- ๐Ÿ”— **Transitive dead** member detection - ๐Ÿงน **Automatic removal** of unused code - ๐Ÿ“š **Popular libraries** support - โœจ **Customizable** entrypoints @@ -20,6 +20,7 @@ composer require --dev shipmonk/dead-code-detector Use [official extension-installer](https://phpstan.org/user-guide/extension-library#installing-extensions) or just load the rules: ```neon +# phpstan.neon.dist includes: - vendor/shipmonk/dead-code-detector/rules.neon ``` @@ -112,7 +113,7 @@ class ApiOutputEntrypointProvider extends SimpleMethodEntrypointProvider ๐Ÿ’ก Thus App\Entity\Address::setPostalCode is transitively also unused ๐Ÿ’ก Thus App\Entity\Address::setCountry is transitively also unused ๐Ÿ’ก Thus App\Entity\Address::setStreet is transitively also unused - ๐Ÿ’ก Thus App\Entity\Address::setZip is transitively also unused + ๐Ÿ’ก Thus App\Entity\Address::MAX_STREET_CHARS is transitively also unused ------ ------------------------------------------------------------------------ ``` @@ -145,6 +146,7 @@ class UserFacade - In order to prevent false positives, we support even calls over unknown types (e.g. `$unknown->method()`) by marking all methods named `method` as used - Such behaviour might not be desired for strictly typed codebases, because e.g. single `new $unknown()` will mark all constructors as used - Thus, you can disable this feature in your `phpstan.neon.dist`: +- The same applies to constant fetches over unknown types (e.g. `$unknown::CONSTANT`) ```neon parameters: @@ -155,9 +157,9 @@ parameters: - If you want to check how many of those cases are present in your codebase, you can run PHPStan analysis with `-vvv` and you will see some diagnostics: ``` -Found 2 methods called over unknown type: - โ€ข setCountry, for example in App\Entity\User::updateAddress - โ€ข setStreet, for example in App\Entity\User::updateAddress +Found 2 usages over unknown type: + โ€ข setCountry method, for example in App\Entity\User::updateAddress + โ€ข setStreet method, for example in App\Entity\User::updateAddress ``` ## Comparison with tomasvotruba/unused-public @@ -166,7 +168,7 @@ Found 2 methods called over unknown type: - It cannot detect dead constructors - It does not properly detect calls within inheritance hierarchy - It does not offer any custom adjustments of used methods - - It has almost no built-it library extensions + - It has almost no built-in library extensions - It ignores trait methods - Is lacks many minor features like class-string calls, dynamic method calls, array callbacks, nullsafe call chains etc - It cannot detect dead cycles nor transitively dead methods @@ -196,7 +198,6 @@ parameters: ## Future scope: -- Dead class constant detection - Dead class property detection - Dead class detection