I'm working on a PHP project and I'm facing a strange issue with PHPStan. It keeps reporting a possibly undefined variable, even though I have defined it in an included script.
So here's the situation:
I have a main script called `main.php` where I include another script called `helper.php` using the `require_once` statement. In `helper.php`, I define a variable called `$myVar` and assign it a value. Then, in `main.php`, I try to use that variable, but PHPStan keeps giving me the "possibly undefined variable" warning.
Here's the relevant code in `helper.php`:
$myVar = 'Hello, World!';
And here's how I'm trying to use it in `main.php`:
I have made sure that both `main.php` and `helper.php` are in the same directory, so the file path is correct.
I'm really puzzled as to why PHPStan is flagging this variable as possibly undefined. Am I missing something here? Is there a specific way I should be including the `helper.php` file to ensure that PHPStan recognizes the variable?
I'd really appreciate any insights or suggestions you might have. Thanks in advance!