\phpDocumentor\Plugin\Core\Descriptor\Validator\FunctionsAreAllArgumentsValid

Summary

Methods
Properties
Constants
validate()
No public properties found
No constants found
validateArguments()
isArgumentInDocBlock()
doesArgumentNameMatchParam()
doesArgumentTypehintMatchParam()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

validate()

validate(\phpDocumentor\Reflection\BaseReflector  $element) : \phpDocumentor\Descriptor\Validator\Error|null

Validates whether the given Reflector's arguments match the business rules of phpDocumentor.

Parameters

\phpDocumentor\Reflection\BaseReflector $element

Throws

\UnexpectedValueException

if no DocBlock is associated with the given Reflector.

Returns

\phpDocumentor\Descriptor\Validator\Error|null

validateArguments()

validateArguments(\phpDocumentor\Reflection\FunctionReflector  $element) : \phpDocumentor\Descriptor\Validator\Error|null

Returns an error if the given Reflector's arguments do not match expectations.

Parameters

\phpDocumentor\Reflection\FunctionReflector $element

Returns

\phpDocumentor\Descriptor\Validator\Error|null

isArgumentInDocBlock()

isArgumentInDocBlock(integer  $index, \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector  $argument, \phpDocumentor\Reflection\BaseReflector  $element, array<mixed,\phpDocumentor\Reflection\DocBlock\Tag>  $params) : boolean

Validates whether an argument is mentioned in the docblock.

Parameters

integer $index

The position in the argument listing.

\phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $argument

The argument itself.

\phpDocumentor\Reflection\BaseReflector $element
array<mixed,\phpDocumentor\Reflection\DocBlock\Tag> $params

The list of param tags to validate against.

Returns

boolean —

whether an issue occurred.

doesArgumentNameMatchParam()

doesArgumentNameMatchParam(\phpDocumentor\Reflection\DocBlock\Tag\ParamTag  $param, \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector  $argument, \phpDocumentor\Reflection\BaseReflector  $element) : \phpDocumentor\Descriptor\Validator\Error|null

Validates whether the name of the argument is the same as that of the param tag.

If the param tag does not contain a name then this method will set it based on the argument.

Parameters

\phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param

param to validate with.

\phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $argument

Argument to validate against.

\phpDocumentor\Reflection\BaseReflector $element

Returns

\phpDocumentor\Descriptor\Validator\Error|null —

whether an issue occurred

doesArgumentTypehintMatchParam()

doesArgumentTypehintMatchParam(\phpDocumentor\Reflection\DocBlock\Tag\ParamTag  $param, \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector  $argument, \phpDocumentor\Reflection\BaseReflector  $element) : \phpDocumentor\Descriptor\Validator\Error|null

Checks the typehint of the argument versus the @param tag.

If the argument has no typehint we do not check anything. When multiple type are given then the typehint needs to be one of them.

Parameters

\phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param
\phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $argument
\phpDocumentor\Reflection\BaseReflector $element

Returns

\phpDocumentor\Descriptor\Validator\Error|null