Repository: symfony/symfony
File: src/Symfony/Component/Translation/Bridge/Crowdin/CrowdinProvider.php (PHP)

Code before:
                continue;
            }

            $importStatusData = $importStatusResponse->toArray()['data'];

            if ('finished' === $importStatusData['status']) {
                unset($responses[$index]);
                continue;
            }

            if ('failed' === $importStatusData['status']) {
                $message = $importStatusData['attributes']['error']['message'] ?? null;

                if ($message) {
                    $this->logger->error(\sprintf('Unable to upload translations to Crowdin: "%s".', $message));
                } else {
                    $this->logger->error('Unable to upload translations to Crowdin.');
                }

                unset($responses[$index]);
            }
        }

        if ([] !== $responses) {
            sleep(1);
            $this->waitForImportCompletion($responses);
        }
    }

    public function read(array $domains, array $locales): TranslatorBag
    {
        $fileList = $this->getFileList();
        $languageMapping = $this->getLanguageMapping();

        $translatorBag = new TranslatorBag();
        $responses = [];

        foreach ($domains as $domain) {
            $fileId = $this->getFileIdByDomain($fileList, $domain);

            if (!$fileId) {
                continue;
            }

            foreach ($locales as $locale) {
                if ($locale !== $this->defaultLocale) {
                    $response = $this->exportProjectTranslations($languageMapping[$locale] ?? $locale, $fileId);
                } else {
                    $response = $this->downloadSourceFile($fileId);
                }


Review comment (suggestion):
since this is a tail-call, I'd rather use a goto instead of a recursive call - or a while loop if you prefer to avoid a goto ;)

Code after:
                    unset($responses[$index]);
                    continue;
                }

                $importStatusData = $importStatusResponse->toArray()['data'];

                if ('finished' === $importStatusData['status']) {
                    unset($responses[$index]);
                    continue;
                }

                if ('failed' === $importStatusData['status']) {
                    $message = $importStatusData['attributes']['error']['message'] ?? null;

                    if ($message) {
                        $this->logger->error(\sprintf('Unable to upload translations to Crowdin: "%s".', $message));
                    } else {
                        $this->logger->error('Unable to upload translations to Crowdin.');
                    }

                    unset($responses[$index]);
                }
            }

            if ($responses) {
                sleep(1);
            }
        }
    }

    public function read(array $domains, array $locales): TranslatorBag
    {
        $fileList = $this->getFileList();
        $languageMapping = $this->getLanguageMapping();

        $translatorBag = new TranslatorBag();
        $responses = [];

        foreach ($domains as $domain) {
            $fileId = $this->getFileIdByDomain($fileList, $domain);

            if (!$fileId) {
                continue;
            }

            foreach ($locales as $locale) {
                if ($locale !== $this->defaultLocale) {
                    $response = $this->exportProjectTranslations($languageMapping[$locale] ?? $locale, $fileId);
                } else {
                    $response = $this->downloadSourceFile($fileId);
                }