Use of App::env() compared to getenv() since Craft 3.4.18 I've noticed since Craft 3.4.18 there is a App::env() function from craft\helpers\App::env(). This was created from the discussion here it seems: https://github.com/craftcms/cms/pull/5893
It seems getenv() can be problematic on multithreaded environments, which is why this change was made.
Should getenv() calls be replaced by App::env() in PHP code now, if using Craft 3.4.18 or above given the App::env() function will check $_ENV first then use getenv() as a fallback?
Yes.
It’s not a requirement, but relying on App::env() is the current best practice and we’ve updated the Composer starter project to use it: https://github.com/craftcms/craft/blob/master/config/db.php