private function fallbackFromDatabaseToConnection(array &$config)
    {
        if (isset($config['database'])) {
            // @codingStandardsIgnoreStart
            @\trigger_error(
                'Config key database is deprecated use instead connection. Fallback will be dropped.',
                E_USER_DEPRECATED
            );
            // @codingStandardsIgnoreEnd

            if (!isset($config['connection'])) {
                $config['connection'] = $config['database'];
            }

            unset($config['database']);
        }

        if (isset($config['connection']) && $config['connection'] instanceof Database) {
            // @codingStandardsIgnoreStart
            @\trigger_error(
                '"' . __METHOD__ . '" now accepts doctrine instances - ' .
                'passing Contao database instances is deprecated.',
                E_USER_DEPRECATED
            );
            // @codingStandardsIgnoreEnd
            $reflection = new \ReflectionProperty(Database::class, 'resConnection');
            $reflection->setAccessible(true);

            $config['connection'] = $reflection->getValue($config['connection']);
        }
    }