Your project should not use function in loops conditions

More information: https://insight.symfony.com/what-we-analyse/php.for_loop_uses_test_function

  1. $contextDocs
  2. )));
  3. $factChecker = new SeoFaqFactChecker($langCode, $this->debug);
  4. $lastGrounding = [];
  5. for ($attempt = 0; $attempt <= EcommerceDefaults::int('CLICSHOPPING_APP_ECOMMERCE_EC_FAQ_MAX_RETRIES'); $attempt++) {
    This loop uses a function. To avoid the overhead of executing the function n times, you should precalculate it before the loop.
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by clicshopping
  6. $faqCandidate = $agent->generateFaqForVars($vars, $langCode);
  7. if (empty($faqCandidate)) {
  8. $this->logDebug('Empty FAQ from agent', ['attempt' => $attempt]);
  9. continue;
  10. }