AddMissingClassPhpDocRector
extends AbstractRector
in package
Provides automated refactoring to prepend basic PHPDoc comments on classes missing them.
This rule MUST adhere to AST standards and SHALL traverse Class_ nodes exclusively.
Table of Contents
Methods
- getNodeTypes() : array<int, Node>>
- Declares the types of Abstract Syntax Tree nodes that trigger this refactoring run.
- getRuleDefinition() : RuleDefinition
- Resolves the definition describing this rule for documentation generation.
- refactor() : Node|null
- Triggers the modification process against a matched AST node.
Methods
getNodeTypes()
Declares the types of Abstract Syntax Tree nodes that trigger this refactoring run.
public
getNodeTypes() : array<int, Node>>
The method MUST identify Class_ nodes reliably. It SHALL define the interception target.
Return values
array<int, Node>> —an array containing registered node class references
getRuleDefinition()
Resolves the definition describing this rule for documentation generation.
public
getRuleDefinition() : RuleDefinition
The method MUST return a properly instantiated RuleDefinition stating its purpose.
Return values
RuleDefinition —the description entity for the given Rector rule
refactor()
Triggers the modification process against a matched AST node.
public
refactor(Node $node) : Node|null
The method MUST verify the absence of an existing PHPDoc header accurately. It SHOULD append a basic boilerplate PHPDoc comment if applicable. If the node is unchanged, it SHALL return null.
Parameters
- $node : Node
-
the current active syntax instance parsed by the framework
Return values
Node|null —the modified active syntax state, or null if untouched