It seems like $boundsNorthEast defined by $this->stringToLatLongValue($imageParameters[0]) on line 37 can be null; however, Maps\Elements\ImageOverlay::__construct() does not accept null, maybe add an additional type check?
Unless you are absolutely sure that the expression can never be null because of
other conditions, we strongly recommend to add an additional type check to your
code:
/** @return stdClass|null */functionmayReturnNull(){}functiondoesNotAcceptNull(stdClass$x){}// With potential error.functionwithoutCheck(){$x=mayReturnNull();doesNotAcceptNull($x);// Potential error here.}// Safe - Alternative 1functionwithCheck1(){$x=mayReturnNull();if(!$xinstanceofstdClass){thrownew\LogicException('$x must be defined.');}doesNotAcceptNull($x);}// Safe - Alternative 2functionwithCheck2(){$x=mayReturnNull();if($xinstanceofstdClass){doesNotAcceptNull($x);}}
It seems like $boundsSouthWest defined by $this->stringToLatLongValue($imageParameters[1]) on line 38 can be null; however, Maps\Elements\ImageOverlay::__construct() does not accept null, maybe add an additional type check?
Unless you are absolutely sure that the expression can never be null because of
other conditions, we strongly recommend to add an additional type check to your
code:
/** @return stdClass|null */functionmayReturnNull(){}functiondoesNotAcceptNull(stdClass$x){}// With potential error.functionwithoutCheck(){$x=mayReturnNull();doesNotAcceptNull($x);// Potential error here.}// Safe - Alternative 1functionwithCheck1(){$x=mayReturnNull();if(!$xinstanceofstdClass){thrownew\LogicException('$x must be defined.');}doesNotAcceptNull($x);}// Safe - Alternative 2functionwithCheck2(){$x=mayReturnNull();if($xinstanceofstdClass){doesNotAcceptNull($x);}}
Loading history...
42
}
43
44
throw new ParseException( 'Need 3 parameters for an image overlay' );
45
}
46
47
private function stringToLatLongValue( $location ) {
48
$latLong = $this->geocoder->geocode( $location );
49
50
if ( $location === null ) {
51
throw new ParseException( 'Failed to parse or geocode' );
This method has been deprecated.