Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check for unused variables/functions in class

I have a large PHP class that has a large variable/function declaration and I wanted to chek if all the variables/functions are being used in the script. Is there something that does this?

like image 585
Phill Pafford Avatar asked May 09 '11 17:05

Phill Pafford


1 Answers

You could use PHP Mess Detector PHP Mess Detector with configuration file:

<?xml version="1.0"?>
<ruleset name="My first PHPMD rule set"
     xmlns="http://pmd.sf.net/ruleset/1.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
                 http://pmd.sf.net/ruleset_xml_schema.xsd"
     xsi:noNamespaceSchemaLocation="
                 http://pmd.sf.net/ruleset_xml_schema.xsd">

    <rule ref="rulesets/unusedcode.xml" />
</ruleset>
like image 147
Marcel Avatar answered Oct 17 '22 12:10

Marcel