| 1 | <?php |
||
| 22 | final class Country |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @var string|null |
||
| 26 | */ |
||
| 27 | private $name; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var string|null |
||
| 31 | */ |
||
| 32 | private $code; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $name |
||
|
|
|||
| 36 | * @param string $code |
||
| 37 | */ |
||
| 38 | public function __construct(string $name = null, string $code = null) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Returns the country name. |
||
| 50 | * |
||
| 51 | * @return string|null |
||
| 52 | */ |
||
| 53 | public function getName() |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Returns the country ISO code. |
||
| 60 | * |
||
| 61 | * @return string|null |
||
| 62 | */ |
||
| 63 | public function getCode() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Returns a string with the country name. |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function __toString(): string |
||
| 77 | } |
||
| 78 |
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.