Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d04dc8

Browse filesBrowse files
[ClassLoader] Deprecated the component
1 parent 5921530 commit 3d04dc8
Copy full SHA for 3d04dc8

14 files changed

+52
-30
lines changed

‎UPGRADE-3.3.md

Copy file name to clipboardExpand all lines: UPGRADE-3.3.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ UPGRADE FROM 3.2 to 3.3
44
ClassLoader
55
-----------
66

7-
* The ApcClassLoader, WinCacheClassLoader and XcacheClassLoader classes have been deprecated
8-
in favor of the `--apcu-autoloader` option introduced in composer 1.3
7+
* The component is deprecated and will be removed in 4.0. Use composer instead.
98

109
DependencyInjection
1110
-------------------

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ UPGRADE FROM 3.x to 4.0
44
ClassLoader
55
-----------
66

7-
* The ApcClassLoader, WinCacheClassLoader and XcacheClassLoader classes have been removed
8-
in favor of the `--apcu-autoloader` option introduced in composer 1.3
7+
* The component has been removed. Use composer instead.
98

109
Console
1110
-------

‎src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
1313

14+
use Composer\Autoload\ClassLoader;
1415
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1516
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
16-
use Symfony\Component\ClassLoader\ClassLoader;
1717

1818
class ControllerNameParserTest extends TestCase
1919
{
@@ -22,17 +22,14 @@ class ControllerNameParserTest extends TestCase
2222
protected function setUp()
2323
{
2424
$this->loader = new ClassLoader();
25-
$this->loader->addPrefixes(array(
26-
'TestBundle' => __DIR__.'/../Fixtures',
27-
'TestApplication' => __DIR__.'/../Fixtures',
28-
));
25+
$this->loader->add('TestBundle', __DIR__.'/../Fixtures');
26+
$this->loader->add('TestApplication', __DIR__.'/../Fixtures');
2927
$this->loader->register();
3028
}
3129

3230
protected function tearDown()
3331
{
34-
spl_autoload_unregister(array($this->loader, 'loadClass'));
35-
32+
$this->loader->unregister();
3633
$this->loader = null;
3734
}
3835

‎src/Symfony/Component/ClassLoader/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/CHANGELOG.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ CHANGELOG
44
3.3.0
55
-----
66

7-
* The ApcClassLoader, WinCacheClassLoader and XcacheClassLoader classes have been deprecated
8-
in favor of the `--apcu-autoloader` option introduced in composer 1.3
7+
* deprecated the component: use composer instead
98

109
3.0.0
1110
-----

‎src/Symfony/Component/ClassLoader/ClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ClassLoader.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\ClassLoader;
1313

14+
@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);
15+
1416
/**
1517
* ClassLoader implements an PSR-0 class loader.
1618
*
@@ -36,6 +38,8 @@
3638
*
3739
* @author Fabien Potencier <fabien@symfony.com>
3840
* @author Jordi Boggiano <j.boggiano@seld.be>
41+
*
42+
* @deprecated since version 3.3, to be removed in 4.0.
3943
*/
4044
class ClassLoader
4145
{

‎src/Symfony/Component/ClassLoader/ClassMapGenerator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ClassMapGenerator.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
namespace Symfony\Component\ClassLoader;
1313

14+
@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);
15+
1416
/**
1517
* ClassMapGenerator.
1618
*
1719
* @author Gyula Sallai <salla016@gmail.com>
20+
*
21+
* @deprecated since version 3.3, to be removed in 4.0.
1822
*/
1923
class ClassMapGenerator
2024
{

‎src/Symfony/Component/ClassLoader/MapClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/MapClassLoader.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
namespace Symfony\Component\ClassLoader;
1313

14+
@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);
15+
1416
/**
1517
* A class loader that uses a mapping file to look up paths.
1618
*
1719
* @author Fabien Potencier <fabien@symfony.com>
20+
*
21+
* @deprecated since version 3.3, to be removed in 4.0.
1822
*/
1923
class MapClassLoader
2024
{

‎src/Symfony/Component/ClassLoader/Psr4ClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/Psr4ClassLoader.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111

1212
namespace Symfony\Component\ClassLoader;
1313

14+
@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);
15+
1416
/**
1517
* A PSR-4 compatible class loader.
1618
*
1719
* See http://www.php-fig.org/psr/psr-4/
1820
*
1921
* @author Alexander M. Turek <me@derrabus.de>
22+
*
23+
* @deprecated since version 3.3, to be removed in 4.0.
2024
*/
2125
class Psr4ClassLoader
2226
{

‎src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Component\ClassLoader\ClassLoader;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class ClassLoaderTest extends \PHPUnit_Framework_TestCase
1720
{
1821
public function testGetPrefixes()

‎src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Component\ClassLoader\ClassMapGenerator;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
1720
{
1821
/**

‎src/Symfony/Component/ClassLoader/Tests/Psr4ClassLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/Tests/Psr4ClassLoaderTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Component\ClassLoader\Psr4ClassLoader;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class Psr4ClassLoaderTest extends \PHPUnit_Framework_TestCase
1720
{
1821
/**

‎src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Debug\Tests\FatalErrorHandler;
1313

1414
use Symfony\Component\Debug\Exception\FatalErrorException;
15-
use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
1615
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
1716
use Symfony\Component\Debug\DebugClassLoader;
1817
use Composer\Autoload\ClassLoader as ComposerClassLoader;
@@ -69,12 +68,10 @@ public function testHandleClassNotFound($error, $translatedMessage, $autoloader
6968

7069
public function provideClassNotFoundData()
7170
{
72-
$prefixes = array('Symfony\Component\Debug\Exception\\' => realpath(__DIR__.'/../../Exception'));
71+
$autoloader = new ComposerClassLoader();
72+
$autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception'));
7373

74-
$symfonyAutoloader = new SymfonyClassLoader();
75-
$symfonyAutoloader->addPrefixes($prefixes);
76-
77-
$debugClassLoader = new DebugClassLoader(array($symfonyAutoloader, 'loadClass'));
74+
$debugClassLoader = new DebugClassLoader(array($autoloader, 'loadClass'));
7875

7976
return array(
8077
array(
@@ -130,7 +127,7 @@ public function provideClassNotFoundData()
130127
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
131128
),
132129
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
133-
array($symfonyAutoloader, 'loadClass'),
130+
array($autoloader, 'loadClass'),
134131
),
135132
array(
136133
array(

‎src/Symfony/Component/Debug/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/composer.json
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
2424
},
2525
"require-dev": {
26-
"symfony/class-loader": "~2.8|~3.0",
2726
"symfony/http-kernel": "~2.8|~3.0"
2827
},
2928
"autoload": {

‎src/Symfony/Component/HttpKernel/Client.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Client.php
+16-9Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,29 @@ protected function getScript($request)
9696
{
9797
$kernel = str_replace("'", "\\'", serialize($this->kernel));
9898
$request = str_replace("'", "\\'", serialize($request));
99-
100-
$r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\ClassLoader');
101-
$requirePath = str_replace("'", "\\'", $r->getFileName());
102-
$symfonyPath = str_replace("'", "\\'", dirname(dirname(dirname(__DIR__))));
10399
$errorReporting = error_reporting();
104100

101+
$requires = '';
102+
foreach (get_declared_classes() as $class) {
103+
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
104+
$r = new \ReflectionClass($class);
105+
$file = dirname(dirname($r->getFileName())).'/autoload.php';
106+
if (file_exists($file)) {
107+
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
108+
}
109+
}
110+
}
111+
112+
if (!$requires) {
113+
throw new \RuntimeException('Composer autoloader not found.');
114+
}
115+
105116
$code = <<<EOF
106117
<?php
107118
108119
error_reporting($errorReporting);
109120
110-
require_once '$requirePath';
111-
112-
\$loader = new Symfony\Component\ClassLoader\ClassLoader();
113-
\$loader->addPrefix('Symfony', '$symfonyPath');
114-
\$loader->register();
121+
$requires
115122
116123
\$kernel = unserialize('$kernel');
117124
\$request = unserialize('$request');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.