1 | <?php |
||
14 | class DocBlockReader |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $comment; |
||
20 | |||
21 | 9 | public function __construct(ReflectionMethod $method) |
|
25 | |||
26 | /** |
||
27 | * Get the description of a method from the doc block |
||
28 | * @param ReflectionMethod $method |
||
|
|||
29 | * @return string|null |
||
30 | */ |
||
31 | 9 | public function getMethodDescription(): ?string |
|
44 | |||
45 | /** |
||
46 | * Get the parameter description |
||
47 | * @param ReflectionParameter $param |
||
48 | * @return string|null |
||
49 | */ |
||
50 | 6 | public function getParameterDescription(ReflectionParameter $param): ?string |
|
60 | |||
61 | /** |
||
62 | * Get the parameter description |
||
63 | * @param ReflectionParameter $param |
||
64 | * @return string|null |
||
65 | */ |
||
66 | 6 | public function getParameterType(ReflectionParameter $param): ?string |
|
76 | |||
77 | 8 | public function getReturnType(): ?string |
|
85 | } |
||
86 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.