public static function checkAutoloadDump(\Composer\Composer $composer)
    {
        if (static::$useAutoloadDump === null) {
            static::$useAutoloadDump = false;

            $rootPackage = static::getRootPackage($composer);
            if (!$rootPackage || ($rootPackage->getType() !== 'project')) {
                return false;
            }

            $rootPackageRequires = $rootPackage->getRequires();
            if (!isset($rootPackageRequires[static::PACKAGE_NAME])) {
                return false;
            }

            $scripts = $rootPackage->getScripts();
            $callback = get_called_class() . '::postAutoloadDump';
            if (!isset($scripts['post-autoload-dump']) || !in_array($callback, $scripts['post-autoload-dump'])) {
                return false;
            }

            static::$useAutoloadDump = true;
        }

        return static::$useAutoloadDump;
    }