xxxxxxxxxx
// Assuming you are working in a class method
if ($someObject !== null) {
$newEntity = $someObject->newEmptyEntity();
// Rest of your code using the $newEntity
} else {
// Handle if $someObject is null
// This can be an error message, exception, or custom handling based on your use case
}