From 797ef33882d284b6ae3789651883e135a714509f Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 7 Aug 2023 16:33:53 -0700 Subject: [PATCH] Define `Top` helper to load classes regardless of namespace prefixing Currently, `cv` has a list of php-scoper rules to exclude certain classes from prefixing. The same list has to be adapted to use in `civix` - so, presumbly, they'll have to be sync'd over time. The main reason for this is to allow the PHAR to call-out to the UF during bootstrap -- and each UF has a different list of rules. In theory, we could drop these rules -- and replace any lines like `drupal_bootstrap()` with `Top::call('drupal_bootstrap')`. Then there would be no need to keep the rules in sync. Additionally, it would allow `cv.phar` to take advantage of libraries (like `symfony/event`) that might be dual-purpose. (Ex: cv.phar and UF both have `EventDispatcher`s; and you want to add listeners to both of them.) --- lib/src/Top.php | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 lib/src/Top.php diff --git a/lib/src/Top.php b/lib/src/Top.php new file mode 100644 index 0000000..5c55118 --- /dev/null +++ b/lib/src/Top.php @@ -0,0 +1,93 @@ +