Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize simple current-class objects for unused private method #1069

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

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

Attention: Patch coverage is 59.15493% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 91.88%. Comparing base (2887ff8) to head (8c8a0b6).

❗ Current head 8c8a0b6 differs from pull request most recent head f69e24e. Consider uploading reports for the commit f69e24e to get more accurate results

Files Patch % Lines
src/main/php/PHPMD/Rule/UnusedPrivateMethod.php 59.15% 29 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1069      +/-   ##
============================================
- Coverage     92.56%   91.88%   -0.69%     
- Complexity     1252     1286      +34     
============================================
  Files           111      111              
  Lines          3429     3498      +69     
============================================
+ Hits           3174     3214      +40     
- Misses          255      284      +29     

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

@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