Version 1
[yaffs-website] / web / core / modules / system / tests / modules / module_install_class_loader_test1 / src / EventSubscriber.php
1 <?php
2
3 namespace Drupal\module_install_class_loader_test1;
4
5 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
6
7 /**
8  * An event subscriber that does different things depending on whether classes
9  * exist.
10  */
11 class EventSubscriber implements EventSubscriberInterface {
12
13   /**
14    * {@inheritdoc}
15    */
16   public static function getSubscribedEvents() {
17     $events = [];
18     // If the autoloader is not fixed during module install when the modules
19     // module_install_class_loader_test1 and module_install_class_loader_test2
20     // are enabled in the same request the class_exists() will cause a crash.
21     // This is because \Composer\Autoload\ClassLoader maintains a negative
22     // cache.
23     if (class_exists('\Drupal\module_install_class_loader_test2\EventSubscriber')) {
24       $events = [];
25     }
26     return $events;
27   }
28
29 }