{"repo":"TomasVotruba/unused-public","free":true,"listed":false,"github":"https://github.com/TomasVotruba/unused-public","clone":"git clone https://github.com/TomasVotruba/unused-public.git","description":"Find Unused Public Elements in Your Code","language":"PHP","stars":196,"topics":["dead-code","phpstan","static-analysis"],"license":"MIT","category":"dev-tools","readme_excerpt":"Find Unused Public Elements in Your Code It's easy to find unused private class elements, because they're not used in the class itself. But what about public methods/properties/constants? How can we detect unused public element? find a public method find all public method calls in code and templates if the public method is not found, it probably unused That's exactly what this package does. This technique is very useful for private projects and to detect accidentally used public modifier that should be changed to private as called locally only. Install The package is available for PHP 7.2+ version. Usage With PHPStan extension installer, everything is ready to run. Enable each item on their own with simple configuration: Do you have hundreds of reported public method? You don't have time to check them all, but want to handle them gradually? Set maximum allowed % configuration instead: This means maximum 2.5 % of all public methods is allowed as unused: If it's 5 %, you'll be alerted. If it's 1 %, it will be skipped as tolerated. Do you want to check local-only method calls that should not be removed, but be turned into private / protected instead? Exclude methods called in templates Some methods are used only in TWIG or Blade templates, and could be reported false positively as unused. How can we exclude them? Add your TWIG or Blade template directories in config to exclude methods names: Known Limitations In some cases, the rules report false positives: when used only in tem","default_branch":null,"files":null,"tree":[],"storefront":"/r/TomasVotruba","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/TomasVotruba/unused-public/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}