1 | <?php |
||
7 | abstract class ParsedObject |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $docBlock; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $name; |
||
18 | |||
19 | 72 | public function __construct(string $doc, string $name) |
|
24 | |||
25 | /** |
||
26 | * Get the name of a parsed object. |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | 24 | public function getName(): string |
|
34 | |||
35 | /** |
||
36 | * Get the doc block comments of a parsed object. |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | 20 | public function getDocBlock() |
|
44 | |||
45 | /** |
||
46 | * Returns whether or not the parsed object |
||
47 | * has an annotation matching the name and value |
||
48 | * if provided. |
||
49 | * |
||
50 | * @param string $anno |
||
|
|||
51 | * @param mixed $value |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | 7 | public function hasAnnotation(string $annotation, string $value = null): bool |
|
65 | } |
||
66 |
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.