[TASK] Update to latest class alias loader version 92/42492/3
authorHelmut Hummel <helmut.hummel@typo3.org>
Mon, 10 Aug 2015 21:06:17 +0000 (23:06 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 10 Aug 2015 22:50:27 +0000 (00:50 +0200)
Benefit from several class alias loader package improvements:

* Use alias map API of this package to resolve and add aliases
* Use new option to force initialization of the alias loader to greatly simplify our runtime code
  This option is only evaluated in non composer mode, which is good because we only need it then.
* Adapt to API change, that now the alias loader is never returned from autoload inclusion

Resolves: #68916
Releases: master
Change-Id: I1aec36634bbfc896c9506c8c846ddf86f78c1693
Reviewed-on: http://review.typo3.org/42492
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
composer.json
composer.lock
typo3/sysext/backend/Classes/Console/Application.php
typo3/sysext/backend/Classes/Http/Application.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/ClassLoadingInformation.php
typo3/sysext/frontend/Classes/Http/Application.php
typo3/sysext/install/Classes/Http/Application.php

index e244790..05f80d7 100644 (file)
@@ -57,6 +57,9 @@
                "ext-zip": ""
        },
        "extra": {
+               "helhum/class-alias-loader": {
+                       "always-add-alias-loader": true
+               },
                "branch-alias": {
                        "dev-master": "7.x-dev"
                }
index 1c079fc..72d26e6 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "0f463179dd109b3ff4000ea49c17cec9",
+    "hash": "6baf4c6d3b67a0f30e2f1d9f6c84f446",
     "packages": [
         {
             "name": "doctrine/instantiator",
         },
         {
             "name": "helhum/class-alias-loader",
-            "version": "2.0.0",
+            "version": "2.1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/helhum/class-alias-loader.git",
-                "reference": "28e9155b8ab3f2871f32899d4fa355fd14daba95"
+                "reference": "91ef94c5a0ab6883018c8125ed66c00e5704ff6a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/helhum/class-alias-loader/zipball/28e9155b8ab3f2871f32899d4fa355fd14daba95",
-                "reference": "28e9155b8ab3f2871f32899d4fa355fd14daba95",
+                "url": "https://api.github.com/repos/helhum/class-alias-loader/zipball/91ef94c5a0ab6883018c8125ed66c00e5704ff6a",
+                "reference": "91ef94c5a0ab6883018c8125ed66c00e5704ff6a",
                 "shasum": ""
             },
             "require": {
                 "classloader",
                 "composer"
             ],
-            "time": "2015-08-06 22:03:20"
+            "time": "2015-08-10 20:58:34"
         },
         {
             "name": "pear/http_request2",
index c86b453..33b2210 100644 (file)
@@ -44,7 +44,7 @@ class Application implements ApplicationInterface {
        /**
         * Constructor setting up legacy constants and register available Request Handlers
         *
-        * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\ClassAliasLoader $classLoader an instance of the class loader
+        * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
         */
        public function __construct($classLoader) {
                $this->checkEnvironmentOrDie();
index 3b77c66..b7e5d49 100644 (file)
@@ -50,7 +50,7 @@ class Application implements ApplicationInterface {
        /**
         * Constructor setting up legacy constant and register available Request Handlers
         *
-        * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\ClassAliasLoader $classLoader an instance of the class loader
+        * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
         */
        public function __construct($classLoader) {
                $this->defineLegacyConstants();
index 5eb1d54..ef9047c 100644 (file)
@@ -192,7 +192,7 @@ class Bootstrap {
        /**
         * Sets the class loader to the bootstrap
         *
-        * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\ClassAliasLoader $classLoader an instance of the class loader
+        * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
         * @return Bootstrap
         * @internal This is not a public API method, do not use in own extensions
         */
index 9497304..231407e 100644 (file)
@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Core\Core;
  */
 
 use Composer\Autoload\ClassLoader as ComposerClassLoader;
-use Helhum\ClassAliasLoader\ClassAliasLoader;
+use Helhum\ClassAliasLoader\ClassAliasMap;
 use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -90,7 +90,7 @@ class ClassLoadingInformation {
                if (file_exists($dynamicClassAliasMapFile)) {
                        $classAliasMap = require $dynamicClassAliasMapFile;
                        if (is_array($classAliasMap) && !empty($classAliasMap['aliasToClassNameMapping']) && !empty($classAliasMap['classNameToAliasMapping'])) {
-                               self::getClassAliasLoader($composerClassLoader)->addAliasMap($classAliasMap);
+                               ClassAliasMap::addAliasMap($classAliasMap);
                        }
                }
 
@@ -132,7 +132,7 @@ class ClassLoadingInformation {
                }
                $classAliasMap = $generator->buildClassAliasMapForPackage($package);
                if (is_array($classAliasMap) && !empty($classAliasMap['aliasToClassNameMapping']) && !empty($classAliasMap['classNameToAliasMapping'])) {
-                       self::getClassAliasLoader($composerClassLoader)->addAliasMap($classAliasMap);
+                       ClassAliasMap::addAliasMap($classAliasMap);
                }
        }
 
@@ -154,11 +154,7 @@ class ClassLoadingInformation {
         * @return mixed
         */
        static public function getClassNameForAlias($alias) {
-               $composerClassLoader = static::getClassLoader();
-               if (!is_callable(array($composerClassLoader, 'getClassNameForAlias'))) {
-                       return $alias;
-               }
-               return $composerClassLoader->getClassNameForAlias($alias);
+               return ClassAliasMap::getClassNameForAlias($alias);
        }
 
        /**
@@ -177,29 +173,11 @@ class ClassLoadingInformation {
        /**
         * Internal method calling the bootstrap to fetch the composer class loader
         *
-        * @return ClassAliasLoader|ComposerClassLoader
+        * @return ComposerClassLoader
         * @throws \TYPO3\CMS\Core\Exception
         */
        static protected function getClassLoader() {
                return Bootstrap::getInstance()->getEarlyInstance(ComposerClassLoader::class);
        }
 
-       /**
-        * Internal method calling the bootstrap to fetch the composer class loader
-        *
-        * @param ClassAliasLoader|ComposerClassLoader $composerClassLoader
-        * @return ClassAliasLoader
-        * @throws \TYPO3\CMS\Core\Exception
-        */
-       static protected function getClassAliasLoader($composerClassLoader) {
-               if ($composerClassLoader instanceof ClassAliasLoader) {
-                       return $composerClassLoader;
-               }
-               $aliasLoader = new ClassAliasLoader($composerClassLoader);
-               $aliasLoader->register(TRUE);
-               Bootstrap::getInstance()->setEarlyInstance(ComposerClassLoader::class, $aliasLoader);
-
-               return $aliasLoader;
-       }
-
 }
index 43d29d4..9800993 100644 (file)
@@ -45,7 +45,7 @@ class Application implements ApplicationInterface {
        /**
         * Constructor setting up legacy constant and register available Request Handlers
         *
-        * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\ClassAliasLoader $classLoader an instance of the class loader
+        * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
         */
        public function __construct($classLoader) {
                $this->defineLegacyConstants();
index 929fe4c..db6113a 100644 (file)
@@ -43,7 +43,7 @@ class Application implements ApplicationInterface {
        /**
         * Constructor setting up legacy constant and register available Request Handlers
         *
-        * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\ClassAliasLoader $classLoader an instance of the class loader
+        * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
         */
        public function __construct($classLoader) {
                $this->defineLegacyConstants();