- 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. - 🇬🇧United Kingdom alexpott 🇪🇺🌍
Backported to 11.1.x as test-only change.
Committed and pushed c8a7a5894c9 to 11.x and 5f901886979 to 11.2.x and bc806750d89 to 11.1.x. Thanks!
-
alexpott →
committed bc806750 on 11.1.x
Issue #3366862 by mondrake, daffie: Refactor...
-
alexpott →
committed bc806750 on 11.1.x
-
alexpott →
committed 5f901886 on 11.2.x
Issue #3366862 by mondrake, daffie: Refactor...
-
alexpott →
committed 5f901886 on 11.2.x
-
alexpott →
committed c8a7a589 on 11.x
Issue #3366862 by mondrake, daffie: Refactor...
-
alexpott →
committed c8a7a589 on 11.x