| 1 | <?php |
||
| 9 | class Address implements \JsonSerializable |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string $address |
||
| 13 | */ |
||
| 14 | protected $address; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string $name |
||
| 18 | */ |
||
| 19 | private $name; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Address constructor. |
||
| 23 | * |
||
| 24 | * @param string $address |
||
| 25 | * @param string $name |
||
| 26 | */ |
||
| 27 | 11 | public function __construct(string $address, string $name = '') |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 4 | public function getAddress(): string |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 1 | public function getName(): string |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @return boolean |
||
| 51 | */ |
||
| 52 | 1 | public function isValid(): bool |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Checks, if the given addresses are equal. this only includes the address, the name is being ignored |
||
| 59 | * |
||
| 60 | * @param Address $address |
||
|
|
|||
| 61 | * |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | 3 | public function equals(self $address): bool |
|
| 68 | |||
| 69 | /** |
||
| 70 | * Specify data which should be serialized to JSON |
||
| 71 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
| 72 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
| 73 | * which is a value of any type other than a resource. |
||
| 74 | * @since 5.4.0 |
||
| 75 | */ |
||
| 76 | public function jsonSerialize() |
||
| 80 | } |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.