Commit 21b27e3b authored by alexpott's avatar alexpott

Issue #2468499 by webflo: Add vendor libs to classmap through composer script event

parent 34e7824c
......@@ -48,19 +48,14 @@
"lib/Drupal/Core/Database/Database.php",
"lib/Drupal/Core/DrupalKernel.php",
"lib/Drupal/Core/DrupalKernelInterface.php",
"lib/Drupal/Core/Site/Settings.php",
"vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php",
"vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php",
"vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php",
"vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php",
"vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php",
"vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php",
"vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php",
"vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php"
"lib/Drupal/Core/Site/Settings.php"
]
},
"config": {
"preferred-install": "dist",
"autoloader-suffix": "Drupal8"
},
"scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump"
}
}
<?php
/**
* @file
* Contains \Drupal\Core\Composer\Composer.
*/
namespace Drupal\Core\Composer;
use Composer\Script\Event;
/**
* Provides static functions for composer script events.
*
* @see https://getcomposer.org/doc/articles/scripts.md
*/
class Composer {
/**
* Add vendor classes to composers static classmap.
*/
public static function preAutoloadDump(Event $event) {
$composer = $event->getComposer();
$package = $composer->getPackage();
$autoload = $package->getAutoload();
$autoload['classmap'] = array_merge($autoload['classmap'], array(
'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php',
'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php',
'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php',
'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php',
'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php',
'vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php',
'vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php',
'vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php'
));
$package->setAutoload($autoload);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment