PHP 클래스 PHPMD\Rule\UnusedLocalVariable

저자: Manuel Pichler ([email protected])
상속: extends PHPMD\Rule\AbstractLocalVariable, implements FunctionAware, implements MethodAware
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 메소드들

메소드 설명
apply ( PHPMD\AbstractNode $node ) : void This method checks that all local variables within the given function or method are used at least one time.

보호된 메소드들

메소드 설명
doCheckNodeImage ( PHPMD\AbstractNode $node ) : void Template method that performs the real node image check.

비공개 메소드들

메소드 설명
collectLiteral ( PHPMD\Node\ASTNode $node ) : void Stores the given literal node in an internal list of found variables.
collectVariable ( PHPMD\Node\ASTNode $node ) : void Stores the given variable node in an internal list of found variables.
collectVariables ( PHPMD\Node\AbstractCallableNode $node ) : void This method collects all local variable instances from the given method/function node and stores their image in the $_images property.
isChildOf ( PHPMD\AbstractNode $node, string $type ) : boolean Checks if the given node is a direct or indirect child of a node with the given type.
isNameAllowedInContext ( PHPMD\AbstractNode $node ) : boolean Checks if a short name is acceptable in the current context. For the moment these contexts are the init section of a for-loop and short variable names in catch-statements.
isUnusedForeachVariableAllowed ( PHPMD\Node\ASTNode $variable ) : boolean Checks if an unused foreach variable (key or variable) is allowed.
removeParameters ( PHPMD\Node\AbstractCallableNode $node ) : void This method removes all variables from the $_images property that are also found in the formal parameters of the given method or/and function node.

메소드 상세

apply() 공개 메소드

This method checks that all local variables within the given function or method are used at least one time.
public apply ( PHPMD\AbstractNode $node ) : void
$node PHPMD\AbstractNode
리턴 void

doCheckNodeImage() 보호된 메소드

Template method that performs the real node image check.
protected doCheckNodeImage ( PHPMD\AbstractNode $node ) : void
$node PHPMD\AbstractNode
리턴 void