aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/composer/ClassLoader.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-03-19 13:55:18 +0000
committerMario <mario@mariovavti.com>2023-03-19 13:55:18 +0000
commit89285f1408d21091bb80d45b391ddcbe06ba8d0f (patch)
treeb2eb07d9f3d91d77f89a4565a58e6e5231b20c1c /vendor/composer/ClassLoader.php
parent0a679e503ef367eda3085c44af103ee53869a94f (diff)
parent17c0bb2069dcfe35d3febc5bfdb3a7295f15d49c (diff)
downloadvolse-hubzilla-8.2.tar.gz
volse-hubzilla-8.2.tar.bz2
volse-hubzilla-8.2.zip
Merge branch '8.2RC'8.2
Diffstat (limited to 'vendor/composer/ClassLoader.php')
-rw-r--r--vendor/composer/ClassLoader.php40
1 files changed, 26 insertions, 14 deletions
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index 3a8ed4886..a72151c77 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -43,7 +43,7 @@ namespace Composer\Autoload;
class ClassLoader
{
/** @var \Closure(string):void */
- private $includeFile;
+ private static $includeFile;
/** @var ?string */
private $vendorDir;
@@ -109,18 +109,7 @@ class ClassLoader
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
-
- /**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- *
- * @param string $file
- * @return void
- */
- $this->includeFile = static function($file) {
- include $file;
- };
+ self::initializeIncludeClosure();
}
/**
@@ -440,7 +429,8 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
- ($this->includeFile)($file);
+ $includeFile = self::$includeFile;
+ $includeFile($file);
return true;
}
@@ -570,4 +560,26 @@ class ClassLoader
return false;
}
+
+ /**
+ * @return void
+ */
+ private static function initializeIncludeClosure()
+ {
+ if (self::$includeFile !== null) {
+ return;
+ }
+
+ /**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ *
+ * @param string $file
+ * @return void
+ */
+ self::$includeFile = \Closure::bind(static function($file) {
+ include $file;
+ }, null, null);
+ }
}