It seems like $element defined by $translator->translateNode($node) on line 60 can be null; however, Dgame\Soap\Hydrator\Hydrator::hydrate() 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...
63
}
64
65
/**
66
* @param Element $element
67
*
68
* @return HydrateProcedure
69
*/
70
private function hydrate(Element $element): HydrateProcedure
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: