mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add type hinting in Point and PointException
This commit is contained in:
parent
7c99f0b3e0
commit
e90ea31683
@ -13,7 +13,7 @@ class Point implements JsonSerializable {
|
||||
private float $lon;
|
||||
public static string $SRID = '4326';
|
||||
|
||||
private function __construct($lon, $lat)
|
||||
private function __construct(float $lon, float $lat)
|
||||
{
|
||||
$this->lat = $lat;
|
||||
$this->lon = $lon;
|
||||
@ -52,7 +52,7 @@ class Point implements JsonSerializable {
|
||||
* @param type $geojson
|
||||
* @return Point
|
||||
*/
|
||||
public static function fromGeoJson($geojson): Point
|
||||
public static function fromGeoJson(string $geojson): Point
|
||||
{
|
||||
$a = json_decode($geojson);
|
||||
//check if the geojson string is correct
|
||||
@ -70,7 +70,7 @@ class Point implements JsonSerializable {
|
||||
|
||||
}
|
||||
|
||||
public static function fromLonLat($lon, $lat): Point
|
||||
public static function fromLonLat(float $lon, float $lat): Point
|
||||
{
|
||||
if (($lon > -180 && $lon < 180) && ($lat > -90 && $lat < 90))
|
||||
{
|
||||
@ -80,7 +80,7 @@ class Point implements JsonSerializable {
|
||||
}
|
||||
}
|
||||
|
||||
public static function fromArrayGeoJson($array): Point
|
||||
public static function fromArrayGeoJson(array $array): Point
|
||||
{
|
||||
if ($array['type'] == 'Point' &&
|
||||
isset($array['coordinates']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user