AddMissingMethodPhpDocRector

Class
extends AbstractRector
Final: Yes

Executes AST inspections parsing missing documentation on methods automatically.

Description

It MUST append @param, @return, and @throws tags where deduced accurately. The logic SHALL NOT override existing documentation.

Table of Contents

Methods

getNodeTypes()

Designates the primary Abstract Syntax Tree (AST) node structures intercepted.

 : array<int, Node>>
getRuleDefinition()

Delivers the formal rule description configured within the Rector ecosystem.

 : RuleDefinition
refactor()

Computes necessary PHPDoc metadata for a given class method selectively.

 : Node
resolveNameToString()

Expands Name syntax objects into human-readable string descriptors universally.

 : string
resolveThrows()

Parses the architectural scope of an intercepted method to infer exceptional operations natively.

 : array<string|int, string>
resolveTypeToString()

Translates complicated type primitives cleanly back into uniform string declarations consistently.

 : string
Methods

getNodeTypes()

Public

Designates the primary Abstract Syntax Tree (AST) node structures intercepted.

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

Description

The method MUST register solely ClassMethod class references to guarantee precision.

Return values
array<int, Node>>

Description

the structural bindings applicable for this modification

getRuleDefinition()

Public

Delivers the formal rule description configured within the Rector ecosystem.

public getRuleDefinition() : RuleDefinition

Description

The method MUST accurately describe its functional changes logically.

Return values
RuleDefinition

Description

explains the rule's active behavior context

refactor()

Public

Computes necessary PHPDoc metadata for a given class method selectively.

public refactor(Node  $node) : Node

Description

The method MUST identify the missing @param, @return, and @throws tags algorithmically. It SHALL preserve pre-existing valid tags cleanly. If no augmentation is achieved, it returns the node unaltered.

Parameters
$node : Node

Description

the target method representation parsed synchronously

Return values
Node

Description

the refined active syntax instance inclusive of generated documentation

resolveNameToString()

Private

Expands Name syntax objects into human-readable string descriptors universally.

private resolveNameToString(Name  $name) : string

Description

The method MUST handle aliases seamlessly or fallback to base names dependably.

Parameters
$name : Name

Description

the structured reference to parse accurately

Return values
string

Description

the computed class identifier successfully reconstructed

resolveThrows()

Private

Parses the architectural scope of an intercepted method to infer exceptional operations natively.

private resolveThrows(ClassMethod  $node) : array<string|int, string>

Description

This method MUST accurately deduce exception creations traversing internal components recursively. It SHALL strictly return precise, unique internal naming identifiers safely.

Parameters
$node : ClassMethod

Description

the active evaluated root target element dynamically instantiated

Return values
array<string|int, string>

Description

expected failure objects effectively defined within its contextual boundary

resolveTypeToString()

Private

Translates complicated type primitives cleanly back into uniform string declarations consistently.

private resolveTypeToString( string|Identifier|Name|ComplexType|null  $type) : string

Description

The method MUST parse complex combinations including Intersections, Unions natively and securely.

Parameters
$type : string|Identifier|Name|ComplexType|null

Description

the original metadata instance safely captured

Return values
string

Description

the final interpreted designation string explicitly represented safely