wp_get_environment_type arrives in 5.5; here is the 2019 version

WordPress has no concept of an environment, so every site invents one — and the versions differ enough that a shared plugin cannot rely on any of them.

// wp-config.php
define( 'TURKERDEV_ENV', getenv( 'APP_ENV' ) ?: 'production' );

function turkerdev_env(): string {
    return defined( 'TURKERDEV_ENV' ) ? TURKERDEV_ENV : 'production';
}

// defaulting to production is the important half:
// a misconfigured host should be cautious, not chatty.

Defaulting to production rather than development is what stops a missing variable turning on debug output on a live site. Core adds wp_get_environment_type() in 5.6 with the same defaulting, so naming the constant WP_ENVIRONMENT_TYPE now means the migration later is deleting a function. The values worth supporting are the ones core will use — production, staging, development, local — rather than whatever the hosting panel calls them.