Reputation: 4710
I am using php code sniffer with smyfony 3.1.
Package Name:Squiz I am trying to run phpcs command in my symfony based project.
Command:
phpcs --standard=/c/xampp/php/pear/PHP/CodeSniffer/Standards/Squiz src/MYBundle/Controller/MYController.php
Command is working fine, In this controller/class i have declared some private variable and method name which is not used anywhere in the controller/class.
Ruleset
I have appended new rule in the ruleset.xml file and create new file under this directory [Sniffs\Rule\UnusedPrivateField] UnusedPrivateField.php
<rule name="UnusedPrivateField"
since="0.2"
message="Avoid unused private fields such as '{0}'."
class="Sniffs\Rule\UnusedPrivateField"
externalInfoUrl="http://phpmd.org/rules/unusedcode.html#unusedprivatefield"></rule>
Question: How to call "UnusedPrivateField.php" code from new rule set ?
Upvotes: 1
Views: 2118
Reputation: 24280
You can use UnusedPrivateElementsSniff for this.
I use it for over a year and it works great.
Upvotes: 1