PHP Класс PHPMD\Rule\UnusedPrivateField

Автор: Manuel Pichler ([email protected])
Наследование: extends PHPMD\AbstractRule, implements ClassAware
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
apply ( PHPMD\AbstractNode $node ) : void This method checks that all private class properties are at least accessed by one method.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

apply() публичный Метод

This method checks that all private class properties are at least accessed by one method.
public apply ( PHPMD\AbstractNode $node ) : void
$node PHPMD\AbstractNode
Результат void

isInScopeOfClass() защищенный Метод

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
Результат boolean

isValidPropertyNode() защищенный Метод

Checks if the given node is a valid property node.
С версии: 0.2.6
protected isValidPropertyNode ( PHPMD\Node\ASTNode $node = null ) : boolean
$node PHPMD\Node\ASTNode
Результат boolean