src/controllers/ExtensionsController.php
private static function uninstall($extension, ReportingChain $chain)
    {
        $module = ExtensionsManager::module();
        if (true === $module->extensionIsCore($extension['composer_name'])) {
            $dummyTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/dummy',
                    '--no-interaction',
                    '-o',
                    'You are unable to uninstall core extensions!',
                ],
                ExtensionsManager::EXTENSION_DUMMY_DEFERRED_GROUP
            );
            $chain->addTask($dummyTask);
        } else {
            self::deactivate($extension, $chain);
            $uninstallTask = ExtensionDataHelper::buildTask(
                [
                    $module->composerPath,
                    'remove',
                    $extension['composer_name'],
                    '--no-ansi',
                    '--no-interaction',
                    "--working-dir={$module->getLocalExtensionsPath()}",
                    $module->verbose == 1 ? '-vvv' : '',
                ],
                ExtensionsManager::COMPOSER_UNINSTALL_DEFERRED_GROUP
            );
            $chain->addTask($uninstallTask);
        }
    }
private static function uninstall($extension, ReportingChain $chain)
    {
        $module = ExtensionsManager::module();
        if (true === $module->extensionIsCore($extension['composer_name'])) {
            $dummyTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/dummy',
                    '--no-interaction',
                    '-o',
                    'You are unable to uninstall core extensions!',
                ],
                ExtensionsManager::EXTENSION_DUMMY_DEFERRED_GROUP
            );
            $chain->addTask($dummyTask);
        } else {
            self::deactivate($extension, $chain);
            $uninstallTask = ExtensionDataHelper::buildTask(
                [
                    $module->composerPath,
                    'remove',
                    $extension['composer_name'],
                    '--no-ansi',
                    '--no-interaction',
                    "--working-dir={$module->getLocalExtensionsPath()}",
                    $module->verbose == 1 ? '-vvv' : '',
                ],
                ExtensionsManager::COMPOSER_UNINSTALL_DEFERRED_GROUP
            );
            $chain->addTask($uninstallTask);
        }
    }
Adds uninstall task into ReportingChain

@param $extension
@param ReportingChain $chain