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