I would like to switch to Visual Studio Code for PHP development.
All of my files start with require_once
with this syntax
require_once(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'RequireCommonStuff.php');
and debugging won't launch, presumably because VSC says that there are problems with the file to be debugged, along the lines of
Undefined function 'DumpGetAndPostParametersIfDebugging'.
where that function is declared in one of my required files.
Strangely, there are no problems reported for the require_once
statements, but I can think of no other explanation for the function not being found.
The code works just fine with PHPstorm, I am testing on localhost
- any ideas as to what I am doing wrongly?
[Update] the error is happenig with every function which is declared in a required file. Here's what leads to the first example.
in RequireCommonStuff.php
, I just have more require_once
s :
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'constants.php');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR .'ChromePhp.php');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'errorHandling.php');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'trace.php');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'parseAndValidateUrlGetParameters.php');
The last of those is causing the error I discuss (although all of them cause erros). It's contents are (note: no classes involved), header comment stripped
function ParseAndValidateUrlGetParameters($url,
$inputType,
$filter,
$debug,
$reportIndicent=true,
$allFieldsMandatory=true)
{
not sure about it but you can install and test PHP Intelephense instead of Intellisense. also check if php path is added in vscode "php.validate.executablePath".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With