1 | <?php |
||
9 | class Street implements ValueObjectInterface |
||
10 | { |
||
11 | /** @var StringLiteral */ |
||
12 | protected $name; |
||
13 | |||
14 | /** @var StringLiteral */ |
||
15 | protected $number; |
||
16 | |||
17 | /** @var String Building, floor and unit */ |
||
18 | protected $elements; |
||
19 | |||
20 | /** |
||
21 | * @var String __toString() format |
||
22 | * Use properties corresponding placeholders: %name%, %number%, %elements% |
||
23 | */ |
||
24 | protected $format; |
||
25 | |||
26 | /** |
||
27 | * Returns a new Street from native PHP string name and number. |
||
28 | * |
||
29 | * @param string $name |
||
|
|||
30 | * @param string $number |
||
31 | * @param string $elements |
||
32 | * |
||
33 | * @return Street |
||
34 | * @throws \BadFunctionCallException |
||
35 | */ |
||
36 | 2 | public static function fromNative() |
|
56 | |||
57 | /** |
||
58 | * Returns a new Street object |
||
59 | * |
||
60 | * @param String $name |
||
61 | * @param String $number |
||
62 | */ |
||
63 | 18 | public function __construct(StringLiteral $name, StringLiteral $number, StringLiteral $elements = NULL, StringLiteral $format = NULL) |
|
64 | { |
||
65 | 18 | $this->name = $name; |
|
66 | 18 | $this->number = $number; |
|
67 | |||
68 | 18 | if ($elements === NULL) { |
|
69 | 12 | $elements = new StringLiteral(''); |
|
70 | 12 | } |
|
71 | 18 | $this->elements = $elements; |
|
72 | |||
73 | 18 | if ($format === NULL) { |
|
74 | 13 | $format = new StringLiteral('%number% %name%'); |
|
75 | 13 | } |
|
76 | 18 | $this->format = $format; |
|
77 | 18 | } |
|
78 | |||
79 | /** |
||
80 | * Tells whether two Street objects are equal |
||
81 | * |
||
82 | * @param ValueObjectInterface $street |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 5 | public function sameValueAs(ValueObjectInterface $street) |
|
96 | |||
97 | /** |
||
98 | * Returns street name |
||
99 | * |
||
100 | * @return String |
||
101 | */ |
||
102 | 8 | public function getName() |
|
106 | |||
107 | /** |
||
108 | * Returns street number |
||
109 | * |
||
110 | * @return String |
||
111 | */ |
||
112 | 8 | public function getNumber() |
|
116 | |||
117 | /** |
||
118 | * Returns street elements |
||
119 | * |
||
120 | * @return String |
||
121 | */ |
||
122 | 8 | public function getElements() |
|
126 | |||
127 | /** |
||
128 | * Returns a string representation of the StringLiteral in the format defined in the constructor |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | 2 | public function __toString() |
|
144 | |||
145 | function jsonSerialize() |
||
157 | |||
158 | |||
159 | } |
||
160 |
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.