[ClassLoader] Deprecated the component
This commit is contained in:
parent
5921530a1a
commit
8a37722adb
@ -4,8 +4,7 @@ UPGRADE FROM 3.2 to 3.3
|
||||
ClassLoader
|
||||
-----------
|
||||
|
||||
* The ApcClassLoader, WinCacheClassLoader and XcacheClassLoader classes have been deprecated
|
||||
in favor of the `--apcu-autoloader` option introduced in composer 1.3
|
||||
* The component is deprecated and will be removed in 4.0. Use Composer instead.
|
||||
|
||||
DependencyInjection
|
||||
-------------------
|
||||
|
@ -4,8 +4,7 @@ UPGRADE FROM 3.x to 4.0
|
||||
ClassLoader
|
||||
-----------
|
||||
|
||||
* The ApcClassLoader, WinCacheClassLoader and XcacheClassLoader classes have been removed
|
||||
in favor of the `--apcu-autoloader` option introduced in composer 1.3
|
||||
* The component has been removed. Use Composer instead.
|
||||
|
||||
Console
|
||||
-------
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
||||
use Symfony\Component\ClassLoader\ClassLoader;
|
||||
|
||||
class ControllerNameParserTest extends TestCase
|
||||
{
|
||||
@ -22,17 +22,14 @@ class ControllerNameParserTest extends TestCase
|
||||
protected function setUp()
|
||||
{
|
||||
$this->loader = new ClassLoader();
|
||||
$this->loader->addPrefixes(array(
|
||||
'TestBundle' => __DIR__.'/../Fixtures',
|
||||
'TestApplication' => __DIR__.'/../Fixtures',
|
||||
));
|
||||
$this->loader->add('TestBundle', __DIR__.'/../Fixtures');
|
||||
$this->loader->add('TestApplication', __DIR__.'/../Fixtures');
|
||||
$this->loader->register();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
spl_autoload_unregister(array($this->loader, 'loadClass'));
|
||||
|
||||
$this->loader->unregister();
|
||||
$this->loader = null;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,7 @@ CHANGELOG
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
* The ApcClassLoader, WinCacheClassLoader and XcacheClassLoader classes have been deprecated
|
||||
in favor of the `--apcu-autoloader` option introduced in composer 1.3
|
||||
* deprecated the component: use Composer instead
|
||||
|
||||
3.0.0
|
||||
-----
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\ClassLoader;
|
||||
|
||||
@trigger_error('The '.__NAMESPACE__.'\ClassLoader class is deprecated since version 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* ClassLoader implements an PSR-0 class loader.
|
||||
*
|
||||
@ -36,6 +38,8 @@ namespace Symfony\Component\ClassLoader;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @deprecated since version 3.3, to be removed in 4.0.
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
|
@ -11,10 +11,14 @@
|
||||
|
||||
namespace Symfony\Component\ClassLoader;
|
||||
|
||||
@trigger_error('The '.__NAMESPACE__.'\ClassMapGenerator class is deprecated since version 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* ClassMapGenerator.
|
||||
*
|
||||
* @author Gyula Sallai <salla016@gmail.com>
|
||||
*
|
||||
* @deprecated since version 3.3, to be removed in 4.0.
|
||||
*/
|
||||
class ClassMapGenerator
|
||||
{
|
||||
|
@ -11,10 +11,14 @@
|
||||
|
||||
namespace Symfony\Component\ClassLoader;
|
||||
|
||||
@trigger_error('The '.__NAMESPACE__.'\MapClassLoader class is deprecated since version 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A class loader that uses a mapping file to look up paths.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated since version 3.3, to be removed in 4.0.
|
||||
*/
|
||||
class MapClassLoader
|
||||
{
|
||||
|
@ -11,12 +11,16 @@
|
||||
|
||||
namespace Symfony\Component\ClassLoader;
|
||||
|
||||
@trigger_error('The '.__NAMESPACE__.'\Psr4ClassLoader class is deprecated since version 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A PSR-4 compatible class loader.
|
||||
*
|
||||
* See http://www.php-fig.org/psr/psr-4/
|
||||
*
|
||||
* @author Alexander M. Turek <me@derrabus.de>
|
||||
*
|
||||
* @deprecated since version 3.3, to be removed in 4.0.
|
||||
*/
|
||||
class Psr4ClassLoader
|
||||
{
|
||||
|
@ -13,6 +13,9 @@ namespace Symfony\Component\ClassLoader\Tests;
|
||||
|
||||
use Symfony\Component\ClassLoader\ClassLoader;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetPrefixes()
|
||||
|
@ -13,6 +13,9 @@ namespace Symfony\Component\ClassLoader\Tests;
|
||||
|
||||
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -13,6 +13,9 @@ namespace Symfony\Component\ClassLoader\Tests;
|
||||
|
||||
use Symfony\Component\ClassLoader\Psr4ClassLoader;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class Psr4ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Debug\Tests\FatalErrorHandler;
|
||||
|
||||
use Symfony\Component\Debug\Exception\FatalErrorException;
|
||||
use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
|
||||
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
|
||||
use Symfony\Component\Debug\DebugClassLoader;
|
||||
use Composer\Autoload\ClassLoader as ComposerClassLoader;
|
||||
@ -69,12 +68,10 @@ class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function provideClassNotFoundData()
|
||||
{
|
||||
$prefixes = array('Symfony\Component\Debug\Exception\\' => realpath(__DIR__.'/../../Exception'));
|
||||
$autoloader = new ComposerClassLoader();
|
||||
$autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception'));
|
||||
|
||||
$symfonyAutoloader = new SymfonyClassLoader();
|
||||
$symfonyAutoloader->addPrefixes($prefixes);
|
||||
|
||||
$debugClassLoader = new DebugClassLoader(array($symfonyAutoloader, 'loadClass'));
|
||||
$debugClassLoader = new DebugClassLoader(array($autoloader, 'loadClass'));
|
||||
|
||||
return array(
|
||||
array(
|
||||
@ -130,7 +127,7 @@ class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
|
||||
),
|
||||
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
|
||||
array($symfonyAutoloader, 'loadClass'),
|
||||
array($autoloader, 'loadClass'),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
|
@ -23,7 +23,6 @@
|
||||
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/class-loader": "~2.8|~3.0",
|
||||
"symfony/http-kernel": "~2.8|~3.0"
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -96,22 +96,29 @@ class Client extends BaseClient
|
||||
{
|
||||
$kernel = str_replace("'", "\\'", serialize($this->kernel));
|
||||
$request = str_replace("'", "\\'", serialize($request));
|
||||
|
||||
$r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\ClassLoader');
|
||||
$requirePath = str_replace("'", "\\'", $r->getFileName());
|
||||
$symfonyPath = str_replace("'", "\\'", dirname(dirname(dirname(__DIR__))));
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$file = dirname(dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$requires) {
|
||||
throw new \RuntimeException('Composer autoloader not found.');
|
||||
}
|
||||
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting);
|
||||
|
||||
require_once '$requirePath';
|
||||
|
||||
\$loader = new Symfony\Component\ClassLoader\ClassLoader();
|
||||
\$loader->addPrefix('Symfony', '$symfonyPath');
|
||||
\$loader->register();
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize('$kernel');
|
||||
\$request = unserialize('$request');
|
||||
|
Reference in New Issue
Block a user