public static function buildDic(StringType $definitionFile)
    {
        if (!file_exists($definitionFile())) {
            throw new \Exception(self::ERR_NO_DIC);
        }

        //create dic
        /** @noinspection PhpUndefinedMethodInspection */
        return FFor::create(['definitionFile' => $definitionFile])
            //create the DIC
            ->dic(function () {
                return PHP_MAJOR_VERSION < 7 ? new ServiceContainer() : new ContainerBuilder();
            })
            //do some processing on the DIC
            ->process(function ($dic, $definitionFile) {
                $fileLocator = new FileLocator(dirname($definitionFile()));
                $fileLoaders = [
                    new XmlFileLoader($dic, $fileLocator),
                    new YamlFileLoader($dic, $fileLocator),
                ];
                (new DelegatingLoader(new LoaderResolver($fileLoaders)))->load($definitionFile());
                self::preCompile($dic);
                /** @noinspection PhpUndefinedMethodInspection */
                $dic->compile();
                self::postCompile($dic);
            })
            //return the completed DIC
            ->fyield('dic');
    }