Your project uses non-strict array lookups

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

  1. public function uninstall()
  2. {
  3. parent::uninstall();
  4. $installed = explode(';', MODULE_MODULES_CHATGPT_INSTALLED);
  5. $installed_pos = array_search($this->app->vendor . '\\' . $this->app->code . '\\' . $this->code, $installed);
    array_search() should be called with the third parameter set to true to enable strict comparison and avoid type juggling bugs.
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by clicshopping
  6. if ($installed_pos !== false) {
  7. unset($installed[$installed_pos]);
  8. $this->app->saveCfgParam('MODULE_MODULES_CHATGPT_INSTALLED', implode(';', $installed));

Your project should use dedicated PHP string functions 5

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

  1. $llmProvider = 'openai'; // Default
  2. if (defined('CLICSHOPPING_APP_CHATGPT_CH_MODEL')) {
  3. $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
  4. // Determine provider from model name
  5. if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
    Consider replacing strpos() with str_starts_with() for improved readability.
    Last edited by clicshopping
  6. $llmProvider = 'anthropic';
  7. } elseif (strpos($model, 'mistral') !== false) {
  8. $llmProvider = 'mistral';
  9. } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
  10. $llmProvider = 'ollama';
  1. $llmProvider = 'openai'; // Default
  2. if (defined('CLICSHOPPING_APP_CHATGPT_CH_MODEL')) {
  3. $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
  4. // Determine provider from model name
  5. if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Last edited by clicshopping
  6. $llmProvider = 'anthropic';
  7. } elseif (strpos($model, 'mistral') !== false) {
  8. $llmProvider = 'mistral';
  9. } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
  10. $llmProvider = 'ollama';
  1. $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
  2. // Determine provider from model name
  3. if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
  4. $llmProvider = 'anthropic';
  5. } elseif (strpos($model, 'mistral') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Last edited by clicshopping
  6. $llmProvider = 'mistral';
  7. } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
  8. $llmProvider = 'ollama';
  9. } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
  10. $llmProvider = 'lmstudio';
  1. // Determine provider from model name
  2. if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
  3. $llmProvider = 'anthropic';
  4. } elseif (strpos($model, 'mistral') !== false) {
  5. $llmProvider = 'mistral';
  6. } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
    Consider replacing strpos() with str_starts_with() for improved readability.
    Last edited by clicshopping
  7. $llmProvider = 'ollama';
  8. } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
  9. $llmProvider = 'lmstudio';
  10. } else {
  11. // Default to OpenAI for gpt-* models
  1. $llmProvider = 'anthropic';
  2. } elseif (strpos($model, 'mistral') !== false) {
  3. $llmProvider = 'mistral';
  4. } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
  5. $llmProvider = 'ollama';
  6. } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
    Consider replacing strpos() with str_starts_with() for improved readability.
    Last edited by clicshopping
  7. $llmProvider = 'lmstudio';
  8. } else {
  9. // Default to OpenAI for gpt-* models
  10. $llmProvider = 'openai';
  11. }