From a822a9454533dca6b8cdc8c6d0c6fdaf4748d71b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 23 Apr 2026 01:47:52 +0000 Subject: [PATCH] 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. --- .../Modules/Functions/Http/Executions/Create.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 6e9b178973..f1fc805d53 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -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 = [];