[SonarCloud][PHP] Invalid analyzer (php:S3699) report bug who does not exist

Versions used : SonarCloud with default configuration

We have an bug detected by sonar on a php8.0 project who is clearly not a bug:
Exemple of code:

match ($action) {
  WebhookServiceInterface::CREATE => $this->handleWebhookPostPersist($args->getEntity(), $args, $webhookService),
  WebhookServiceInterface::UPDATE => $this->handleWebhookPostUpdate($args->getEntity(), $args, $webhookService),
  WebhookServiceInterface::DELETE => $this->handleWebhookPostRemove($entityId, $args, $webhookService),
  default => throw new \LogicException("Unexpected webhook action $action")
};

Here there is clearly no assignation but SonarCloud give this error:
Remove this use of the output from “WebhookManagerTrait::handleWebhookPostPersist”; “WebhookManagerTrait::handleWebhookPostPersist” doesn’t return anything.

With this detail:

The output of functions that don’t return anything should not be used

If a function does not return anything, it makes no sense to use its output. Specifically, passing it to another function, or assigning its “result” to a variable is probably a bug because such functions return nothing, which is probably not what was intended.

Noncompliant Code Example

$result = closedir($dir_handle); // Noncompliant, “closedir” does not return anything.

Compliant Solution

closedir($dir_handle);

Hey there.

Thanks for the report. This seems to match a known false-positive that seems to match: SONARPHP-1268: S3699 should not raise on arrow functions

It seems to be the same error, but i can’t add a comment to add match in her case

Hello @Christophe_MAILFERT,

thanks for sharing this false positive with us. I have included the fix in the next increment and it will be available on SonarCloud later this week.

Best,
Nils