for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Germania\Addresses;
trait AddressAwareTrait
{
use AddressProviderTrait;
/**
* @param AddressProviderInterface|null $address
*/
public function setAddress(?AddressProviderInterface $address)
if ($address instanceof AddressInterface):
$this->address = $address;
else:
$this->address = $address->getAddress();
$address
null
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:
function someFunction(A $objectMaybe = null) { if ($objectMaybe instanceof A) { $objectMaybe->doSomething(); } }
endif;
return $this;
}
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: