aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/composer/ClassLoader.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/composer/ClassLoader.php')
-rw-r--r--vendor/composer/ClassLoader.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index afef3fa2a..3a8ed4886 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -42,6 +42,9 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
+ /** @var \Closure(string):void */
+ private $includeFile;
+
/** @var ?string */
private $vendorDir;
@@ -106,6 +109,18 @@ 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;
+ };
}
/**
@@ -425,7 +440,7 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
- includeFile($file);
+ ($this->includeFile)($file);
return true;
}
@@ -556,17 +571,3 @@ class ClassLoader
return false;
}
}
-
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- *
- * @param string $file
- * @return void
- * @private
- */
-function includeFile($file)
-{
- include $file;
-}