AddMissingClassPhpDocRector

Class
extends AbstractRector
Final: Yes

Provides automated refactoring to prepend basic PHPDoc comments on classes missing them.

Description

This rule MUST adhere to AST standards and SHALL traverse Class_ nodes exclusively.

Table of Contents

Methods

getNodeTypes()

Declares the types of Abstract Syntax Tree nodes that trigger this refactoring run.

 : array<int, Node>>
getRuleDefinition()

Resolves the definition describing this rule for documentation generation.

 : RuleDefinition
refactor()

Triggers the modification process against a matched AST node.

 : Node|null
Methods

getNodeTypes()

Public

Declares the types of Abstract Syntax Tree nodes that trigger this refactoring run.

public getNodeTypes() : array<int, Node>>

Description

The method MUST identify Class_ nodes reliably. It SHALL define the interception target.

Return values
array<int, Node>>

Description

an array containing registered node class references

getRuleDefinition()

Public

Resolves the definition describing this rule for documentation generation.

public getRuleDefinition() : RuleDefinition

Description

The method MUST return a properly instantiated RuleDefinition stating its purpose.

Return values
RuleDefinition

Description

the description entity for the given Rector rule

refactor()

Public

Triggers the modification process against a matched AST node.

public refactor(Node  $node) : Node|null

Description

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

Description

the current active syntax instance parsed by the framework

Return values
Node|null

Description

the modified active syntax state, or null if untouched