PHP Class PHPMD\Rule\UnusedPrivateField

Author: Manuel Pichler ([email protected])
Inheritance: extends PHPMD\AbstractRule, implements ClassAware
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Méthode Description
apply ( PHPMD\AbstractNode $node ) : void This method checks that all private class properties are at least accessed by one method.

Méthodes protégées

Méthode Description
isInScopeOfClass ( PHPMD\Node\ClassNode $class, PHPMD\Node\ASTNode $postfix ) : boolean This method checks that the given property postfix is accessed on an instance or static reference to the given class.
isValidPropertyNode ( PHPMD\Node\ASTNode $node = null ) : boolean Checks if the given node is a valid property node.

Private Methods

Méthode Description
collectPrivateField ( PHPMD\Node\ASTNode $declaration ) : void This method extracts all variable declarators from the given field declaration and stores them in the $_fields property.
collectPrivateFields ( PHPMD\Node\ClassNode $class ) : void This method collects all private fields in the given class and stores them in the $_fields property.
collectUnusedPrivateFields ( PHPMD\Node\ClassNode $class ) : PHPMD\AbstractNode[] This method collects all private fields that aren't used by any class method.
removeUsedField ( PHPMD\Node\ASTNode $postfix ) : void This method removes the field from the $_fields property that is accessed through the given property postfix node.
removeUsedFields ( PHPMD\Node\ClassNode $class ) : void This method extracts all property postfix nodes from the given class and removes all fields from the $_fields property that are accessed by one of the postfix nodes.

Method Details

apply() public méthode

This method checks that all private class properties are at least accessed by one method.
public apply ( PHPMD\AbstractNode $node ) : void
$node PHPMD\AbstractNode
Résultat void

isInScopeOfClass() protected méthode

This method checks that the given property postfix is accessed on an instance or static reference to the given class.
protected isInScopeOfClass ( PHPMD\Node\ClassNode $class, PHPMD\Node\ASTNode $postfix ) : boolean
$class PHPMD\Node\ClassNode
$postfix PHPMD\Node\ASTNode
Résultat boolean

isValidPropertyNode() protected méthode

Checks if the given node is a valid property node.
Since: 0.2.6
protected isValidPropertyNode ( PHPMD\Node\ASTNode $node = null ) : boolean
$node PHPMD\Node\ASTNode
Résultat boolean