Skip to content

Conversation

kylekatarnls
Copy link
Member

Type: bugfix
Issue: Resolves #252 / Resolves #558 / Resolves #937
Breaking change: no

Recognize simple constructions of the current class for unused private method rule, such as:

  • parameter typed (with strong type) as an instance of the current class (by name, FQCN, self or static)
  • parameter that can be an instance of current class (nullable/union/intersection type that includes the current class)
  • new Foo (with Foo matching FQCN of the current class, including self, static)
  • clone $this (or clone of a variable recognized as of type of the current class)
  • reference to variable that itself matches one of the rule above (recursively)

Copy link

codecov bot commented Feb 17, 2024

Codecov Report

❌ Patch coverage is 72.26891% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.85%. Comparing base (c14dcb9) to head (8354e05).
⚠️ Report is 40 commits behind head on master.

Files with missing lines Patch % Lines
src/main/php/PHPMD/Utility/CallableArray.php 0.00% 20 Missing ⚠️
src/main/php/PHPMD/Utility/LastVariableWriting.php 65.21% 8 Missing ⚠️
src/main/php/PHPMD/Rule/UnusedPrivateMethod.php 95.16% 3 Missing ⚠️
src/main/php/PHPMD/Utility/Seeker.php 85.71% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1069      +/-   ##
============================================
- Coverage     92.56%   91.85%   -0.72%     
- Complexity     1252     1300      +48     
============================================
  Files           111      114       +3     
  Lines          3429     3534     +105     
============================================
+ Hits           3174     3246      +72     
- Misses          255      288      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kylekatarnls kylekatarnls force-pushed the feature/detect-self-type-for-unused-private-method branch 4 times, most recently from 4ce69a6 to f02541c Compare February 24, 2024 22:17
@kylekatarnls kylekatarnls force-pushed the feature/detect-self-type-for-unused-private-method branch 2 times, most recently from ab8a979 to 6ca471f Compare February 27, 2024 12:35
@kylekatarnls kylekatarnls force-pushed the feature/detect-self-type-for-unused-private-method branch from 6ca471f to 8354e05 Compare February 27, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment