Tools like tapioca (Sorbet's RBI generator) enumerate all constants in loaded gems to generate type definitions. Because Dotenv::Railtie is defined using ActiveSupport::Deprecation::DeprecatedConstantProxy, it registers a real constant on the Dotenv module. This means Dotenv.constants includes :Railtie, and any tool that iterates over those constants triggers the deprecation warning — even though the user never references Dotenv::Railtie in their own code.
DEPRECATION WARNING: Dotenv::Railtie is deprecated! Use Dotenv::Rails instead.
There's no way for users to suppress this since the warning comes from tooling, not their application code.
Replacing DeprecatedConstantProxy with a const_missing hook would preserve the deprecation behavior for actual usage while keeping :Railtie out of Dotenv.constants.
Tools like tapioca (Sorbet's RBI generator) enumerate all constants in loaded gems to generate type definitions. Because
Dotenv::Railtieis defined usingActiveSupport::Deprecation::DeprecatedConstantProxy, it registers a real constant on theDotenvmodule. This meansDotenv.constantsincludes:Railtie, and any tool that iterates over those constants triggers the deprecation warning — even though the user never referencesDotenv::Railtiein their own code.There's no way for users to suppress this since the warning comes from tooling, not their application code.
Replacing
DeprecatedConstantProxywith aconst_missinghook would preserve the deprecation behavior for actual usage while keeping:Railtieout ofDotenv.constants.