I am using Visual Studio Code 1.16.1 together with Felix Becker's PHP Debug extension. I'm connecting to XDebug just fine, can set breakpoints and view variables in the debug pane without any issues.
However, the debug console seems kind of useless, I can only run super basic PHP commands, and I can't seem to evaluate normal PHP commands or interact with my app very well.
I consistently get error evaluating code when attempting to type any PHP statements or expressions in the debug console. It seems like all I am able to do is declare variables, arrays, and objects.
I can't declare classes, functions, use control structures (if, foreach, etc.).
Works:
$x = 4
//4
$x
//4
$x = new stdClass();
//stdClass
$x = [];
//array(0)
($x) ? yes : no
// yes
(!$x) ? yes : no
// no
preg_replace('/dog/', 'cat', 'The quick brown fox jumps over the lazy dog.')
// "The quick brown fox jumps over the lazy cat."
request()
//Illuminate\Http\Request (Laravel helper methods work)
Doesn't Work:
echo "yes"
//error evaluating code
if ($x == 4) { echo "yes" }
//error evaluating code
for ($i=0; $i < 5; $i++) { }
//error evaluating code
function foo() {}
//error evaluating code
class SimpleClass {}
//error evaluating code
$var_dump($x)
//null
Is the debug console supposed to act like a true REPL? I know PHPStorm's console can evaluate any PHP you throw at it, can Visual Studio Code do the same? Is anyone else facing this problem?
Thanks.

