Skip to content

Releases: shipmonk-rnd/dead-code-detector

0.12.2

27 May 12:53
71b8422
Compare
Choose a tag to compare

Fixes

  • tests excluder not to exclude mixed usages in tests (#214)
  • Fix usageProviders.symfony.configDir wiring (#216)

0.12.1

20 May 07:52
12af219
Compare
Choose a tag to compare

Improvements:

  • PHPUnit: support #[DataProviderExternal] (#212)

0.12.0

16 May 13:06
1f0c70e
Compare
Choose a tag to compare

New features:

0.11.1

15 May 15:06
3c273e0
Compare
Choose a tag to compare

Fixes:

  • Fix custom devPaths config for tests excluder (#202)
  • Fix detection of absolute paths in composer.json for tests excluder (#203)
  • Drop provided usage class existence validation (#201)

0.11.0

04 Apr 12:39
337b299
Compare
Choose a tag to compare

New features

  • Support unknown member names like $foo->$unknown() (#189)
    • Such call marks all methods of $foo as used (including possible descendants, ancestors, traits, ...)
  • Reflection provider:
    • Usages like ReflectionClass->getMethods() now mark alive also methods of descendants (#189)
    • Support calls over unbounded ReflectionClass<object> (#193)
      • e.g. $anyObjectReflection->getMethod('foo') marks all foo methods of all types as alive
      • Can be disabled with usageOverMixed excluder
  • New Twig provider:
    • Support #[AsTwigFilter], #[AsTwigFunction], #[AsTwigTest] and new TwigFilter(..., callback) counterparts (#194, @zacharylund)

Fixes:

  • Fix origin file reference for traits (#190)
  • Report dead method line at its name (#192)
  • Fix mixed calls diagnostics when custom excluder is used (#196)

Breaking changes:

  • Inline ignores of method with attribute need to move (#192):
- #[Deprecated] // @phpstan-ignore shipmonk.deadMethod
- public function someMethod(): void
+ #[Deprecated]
+ public function someMethod(): void // @phpstan-ignore shipmonk.deadMethod

0.10.2

28 Mar 12:13
080f8b9
Compare
Choose a tag to compare

Improvements:

  • Symfony:
  • Doctrine:
    • detect repositoryMethod in #[UniqueEntity] (#184)

Fixes:

  • Autoremove: fix removal of transitively dead constants (#183)

0.10.1

25 Mar 15:16
dacb337
Compare
Choose a tag to compare

Improvements

  • Debug: Changing references not to invalidate result cache (#169)
  • Autoremove: warn about kept excluded usages (#175)
 • Removed method UserFacade::deadMethod
   ! Excluded usage at tests/User/UserFacadeTest.php:241 left intact
  • Improve descendant detection for const fetches (#176)

Dependencies

  • phpstan/phpstan now requires ^2.1.9 (was ^2.1.7) (#169)

0.10.0

21 Mar 13:24
1a94628
Compare
Choose a tag to compare

New features:

  • Allow debugging of usages (#165, #172):
parameters:
    shipmonkDeadCode:
        debug:
            usagesOf:
                - App\User\Entity\Address::__construct

with -vvv outputs e.g.:

App\User\Entity\Address::__construct
|
| Marked as alive by:
| entry virtual usage from ShipMonk\PHPStan\DeadCode\Provider\SymfonyUsageProvider (Route method via #[Route] attribute)
|   calls App\User\RegisterUserController::__invoke:36 
|     calls App\User\UserFacade::registerUser:142
|       calls App\User\Entity\Address::__construct
|
| Found 2 usages:
|  • src/User/UserFacade.php:142
|  • tests/User/Entity/AddressTest.php:64 - excluded by tests excluder
  • Improved possible descendant detection (#151)
    • e.g. new Foo->method() does not mark method as used on Foo children anymore

Improvements:

  • Skip private constructors only when those have zero params (#159)
  • Reduce result cache size (#168)
  • Support Symfony's defaultIndexMethod on AutowireLocator/AutowireIterator attribute (#161, @ruudk)

Dependencies

  • Requires phpstan/phpstan ^2.1.7 (was ^2.0.0) (#151)

Breaking changes

  • ClassMemberUsage now requires UsageOrigin, not optionally ClassMethodRef (#165)
  • UsageOriginDetector was removed (#165)
    • use either UsageOrigin::createRegular or UsageOrigin::createVirtual
  • Virtual usages emitted by ReflectionBasedMemberUsageProvider now require note (#171)
    • true => VirtualUsageData::withNote('why considered used')
    • false => null
  • parameter trackMixedAccess was replaced with excluder (#167)
parameters:
    shipmonkDeadCode:
-         trackMixedAccess: false
+         usageExcluders:
+           usageOverMixed:
+               enabled: true

0.9.2

07 Mar 09:26
a4fef66
Compare
Choose a tag to compare

Fixes:

  • TestsUsageExcluder: fix path normalization for phar files (#155)

0.9.1

05 Mar 15:09
febeb01
Compare
Choose a tag to compare

Fixes

  • TestsUsageExcluder: normalize provided paths (#149)