ch0c01dxyz /
instatoken
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare ( strict_types = 1 ); |
||||
| 4 | |||||
| 5 | namespace Ch0c01dxyz\InstaToken\Objects; |
||||
| 6 | |||||
| 7 | /** |
||||
| 8 | * @author Egar Rizki <[email protected]> |
||||
| 9 | */ |
||||
| 10 | class Map |
||||
| 11 | {
|
||||
| 12 | /** |
||||
| 13 | * @var Map |
||||
| 14 | */ |
||||
| 15 | protected $map; |
||||
| 16 | |||||
| 17 | /** |
||||
| 18 | * Map constructor |
||||
| 19 | * |
||||
| 20 | * @param float $lat |
||||
| 21 | * @param float $lng |
||||
| 22 | * @param float $distance |
||||
| 23 | */ |
||||
| 24 | 4 | public function __construct ( float $lat, float $lng, int $distance ) |
|||
| 25 | {
|
||||
| 26 | 4 | $this->map = [ |
|||
|
0 ignored issues
–
show
|
|||||
| 27 | 4 | "lat" => ( float ) $lat, |
|||
| 28 | 4 | "lng" => ( float ) $lng, |
|||
| 29 | 4 | "distance" => ( int ) $distance |
|||
| 30 | ]; |
||||
| 31 | 4 | } |
|||
| 32 | |||||
| 33 | /** |
||||
| 34 | * @return float Latitude |
||||
| 35 | */ |
||||
| 36 | 4 | public function getLat () : float |
|||
| 37 | {
|
||||
| 38 | 4 | return $this->map[ "lat" ]; |
|||
| 39 | } |
||||
| 40 | |||||
| 41 | /** |
||||
| 42 | * @return float Longitude |
||||
| 43 | */ |
||||
| 44 | 4 | public function getLng () : float |
|||
| 45 | {
|
||||
| 46 | 4 | return $this->map[ "lng" ]; |
|||
| 47 | } |
||||
| 48 | |||||
| 49 | /** |
||||
| 50 | * @return int Distance |
||||
| 51 | */ |
||||
| 52 | 4 | public function getDistance () : int |
|||
| 53 | {
|
||||
| 54 | 4 | return $this->map[ "distance" ]; |
|||
| 55 | } |
||||
| 56 | |||||
| 57 | /** |
||||
| 58 | * @return string |
||||
| 59 | */ |
||||
| 60 | public function __toString () : string |
||||
| 61 | {
|
||||
| 62 | return implode( ",", $this->map ); |
||||
|
0 ignored issues
–
show
$this->map of type Ch0c01dxyz\InstaToken\Objects\Map is incompatible with the type array expected by parameter $pieces of implode().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 63 | } |
||||
| 64 | |||||
| 65 | /** |
||||
| 66 | * @return array |
||||
| 67 | */ |
||||
| 68 | public function __toArray () : array |
||||
| 69 | {
|
||||
| 70 | return $this->map; |
||||
|
0 ignored issues
–
show
|
|||||
| 71 | } |
||||
| 72 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..