DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
75 stars 9 forks source link

Incorrect "Unreachable code detected" #565

Closed Skalman closed 1 day ago

Skalman commented 1 month ago

DEVSENSE.phptools-vscode v1.46.15409

In the code below, echo 1 is reported as unreachable, but it is actually reachable.

<?php

function myExit()
{
  exit;
}

isset($_GET['a']) || myExit();

foreach ($_GET['a'] as $a) {
  echo 1; // Unreachable code detected PHP(PHP0419)

  switch (true) {
    case true:
      break;
  }
}
jakubmisek commented 3 days ago

Thank you @Skalman for reporting that. We'll try to provide a fix soon.