- Issue created by @mondrake
- First commit to issue fork.
- Merge request !11814Resolve #3366862 "Refactor installernondefaultdatabasedrivertest to" → (Open) created by mondrake
- 🇮🇹Italy mondrake 🇮🇹
From https://www.php.net/manual/en/function.include.php
When a file is included, the code it contains inherits the variable scope of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward. However, all functions and classes defined in the included file have the global scope.
So in this case,
$databases
is a local variable ofInstallerNonDefaultDatabaseDriverTest::getInstalledDatabaseSettings()
coming from the evaluation of the code in the included settings.php file. - 🇳🇱Netherlands daffie
When a file is included, the code it contains inherits the variable scope of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward. However, all functions and classes defined in the included file have the global scope.
Now I get it. Thanks for the explanation. Could you remove the
assert(isset($databases));
from the PR and add a comment with your explanation? After that it is RTBC for me. - 🇮🇹Italy mondrake 🇮🇹
I had to add the assert since PHPStan was complaining more or less for the same reason of your comment - PHPStan cannot determine what's included in the include (pun intended), so we need to inform it that a variable with that name is existing at that point.
Once the parent is committed I will rebase and add a comment.
- 🇳🇱Netherlands daffie
All code change look good to me.
The test has been improved.
For me it is RTBC.