fix(analyze): drop redundant null-check on injected GeoRecord

PHPStan flagged Executions/Create.php:242 `if ($geoRecord)` as always
true. GeoRecord is DI-injected and non-nullable; the inner guard is
dead weight. Outer `if (!empty($ip))` is the real condition.
This commit is contained in:
Damodar Lohani
2026-04-23 01:47:52 +00:00
parent cf9db4f89f
commit a822a94545
@@ -239,13 +239,11 @@ class Create extends Base
$headers['x-appwrite-client-ip'] = $ip;
if (!empty($ip)) {
if ($geoRecord) {
$eu = Config::getParam('locale-eu');
$eu = Config::getParam('locale-eu');
$headers['x-appwrite-country-code'] = $geoRecord->getCountryCode();
$headers['x-appwrite-continent-code'] = $geoRecord->getContinentCode();
$headers['x-appwrite-continent-eu'] = (\in_array(($geoRecord->getCountryCode()), $eu)) ? 'true' : 'false';
}
$headers['x-appwrite-country-code'] = $geoRecord->getCountryCode();
$headers['x-appwrite-continent-code'] = $geoRecord->getContinentCode();
$headers['x-appwrite-continent-eu'] = (\in_array(($geoRecord->getCountryCode()), $eu)) ? 'true' : 'false';
}
$headersFiltered = [];