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 57bd898

Browse filesBrowse files
author
Hugo Hamon
committed
[ClassLoader] removes deprecated classes from documentation.
1 parent 36e05e9 commit 57bd898
Copy full SHA for 57bd898

File tree

4 files changed

+52
-24
lines changed
Filter options

4 files changed

+52
-24
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ApcClassLoader.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@
1717
* It expects an object implementing a findFile method to find the file. This
1818
* allows using it as a wrapper around the other loaders of the component (the
1919
* ClassLoader and the UniversalClassLoader for instance) but also around any
20-
* other autoloader following this convention (the Composer one for instance)
20+
* other autoloaders following this convention (the Composer one for instance).
21+
*
22+
* // with a Symfony autoloader
23+
* use Symfony\Component\ClassLoader\ClassLoader;
2124
*
2225
* $loader = new ClassLoader();
26+
* $loader->addPrefix('Symfony\Component', __DIR__.'/component');
27+
* $loader->addPrefix('Symfony', __DIR__.'/framework');
28+
*
29+
* // or with a Composer autoloader
30+
* use Composer\Autoload\ClassLoader;
2331
*
24-
* // register classes with namespaces
32+
* $loader = new ClassLoader();
2533
* $loader->add('Symfony\Component', __DIR__.'/component');
2634
* $loader->add('Symfony', __DIR__.'/framework');
2735
*

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/README.md
+22-18Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@ ClassLoader Component
44
ClassLoader loads your project classes automatically if they follow some
55
standard PHP conventions.
66

7-
The Universal ClassLoader is able to autoload classes that implement the PSR-0
7+
The ClassLoader object is able to autoload classes that implement the PSR-0
88
standard or the PEAR naming convention.
99

1010
First, register the autoloader:
1111

1212
```php
13-
require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
13+
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ClassLoader.php';
1414

15-
use Symfony\Component\ClassLoader\UniversalClassLoader;
15+
use Symfony\Component\ClassLoader\ClassLoader;
1616

17-
$loader = new UniversalClassLoader();
17+
$loader = new ClassLoader();
1818
$loader->register();
1919
```
2020

21-
Then, register some namespaces with the `registerNamespace()` method:
21+
Then, register some namespaces with the `addPrefix()` method:
2222

2323
```php
24-
$loader->registerNamespace('Symfony', __DIR__.'/src');
25-
$loader->registerNamespace('Monolog', __DIR__.'/vendor/monolog/src');
24+
$loader->addPrefix('Symfony', __DIR__.'/src');
25+
$loader->addPrefix('Monolog', __DIR__.'/vendor/monolog/src');
2626
```
2727

28-
The `registerNamespace()` method takes a namespace prefix and a path where to
28+
The `addPrefix()` method takes a namespace prefix and a path where to
2929
look for the classes as arguments.
3030

3131
You can also register a sub-namespaces:
3232

3333
```php
34-
$loader->registerNamespace('Doctrine\\Common', __DIR__.'/vendor/doctrine-common/lib');
34+
$loader->addPrefix('Doctrine\\Common', __DIR__.'/vendor/doctrine-common/lib');
3535
```
3636

3737
The order of registration is significant and the first registered namespace
@@ -40,31 +40,35 @@ takes precedence over later registered one.
4040
You can also register more than one path for a given namespace:
4141

4242
```php
43-
$loader->registerNamespace('Symfony', array(__DIR__.'/src', __DIR__.'/symfony/src'));
43+
$loader->addPrefix('Symfony', array(__DIR__.'/src', __DIR__.'/symfony/src'));
4444
```
4545

46-
Alternatively, you can use the `registerNamespaces()` method to register more
46+
Alternatively, you can use the `addPrefixes()` method to register more
4747
than one namespace at once:
4848

4949
```php
50-
$loader->registerNamespaces(array(
50+
$loader->addPrefixes(array(
5151
'Symfony' => array(__DIR__.'/src', __DIR__.'/symfony/src'),
5252
'Doctrine\\Common' => __DIR__.'/vendor/doctrine-common/lib',
5353
'Doctrine' => __DIR__.'/vendor/doctrine/lib',
5454
'Monolog' => __DIR__.'/vendor/monolog/src',
5555
));
5656
```
5757

58-
For better performance, you can use the APC based version of the universal
59-
class loader:
58+
For better performance, you can use the APC class loader:
6059

6160
```php
62-
require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
63-
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
61+
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ClassLoader.php';
62+
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ApcClassLoader.php';
6463

65-
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
64+
use Symfony\Component\ClassLoader\ClassLoader;
65+
use Symfony\Component\ClassLoader\ApcClassLoader;
6666

67-
$loader = new ApcUniversalClassLoader('apc.prefix.');
67+
$loader = new ClassLoader();
68+
$loader->addPrefix('Symfony', __DIR__.'/src');
69+
70+
$loader = new ApcClassLoader('apc.prefix.', $loader);
71+
$loader->register();
6872
```
6973

7074
Furthermore, the component provides tools to aggregate classes into a single

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/WinCacheClassLoader.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@
1717
* It expects an object implementing a findFile method to find the file. This
1818
* allow using it as a wrapper around the other loaders of the component (the
1919
* ClassLoader and the UniversalClassLoader for instance) but also around any
20-
* other autoloader following this convention (the Composer one for instance)
20+
* other autoloaders following this convention (the Composer one for instance).
21+
*
22+
* // with a Symfony autoloader
23+
* use Symfony\Component\ClassLoader\ClassLoader;
2124
*
2225
* $loader = new ClassLoader();
26+
* $loader->addPrefix('Symfony\Component', __DIR__.'/component');
27+
* $loader->addPrefix('Symfony', __DIR__.'/framework');
28+
*
29+
* // or with a Composer autoloader
30+
* use Composer\Autoload\ClassLoader;
2331
*
24-
* // register classes with namespaces
32+
* $loader = new ClassLoader();
2533
* $loader->add('Symfony\Component', __DIR__.'/component');
2634
* $loader->add('Symfony', __DIR__.'/framework');
2735
*

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/XcacheClassLoader.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@
1717
* It expects an object implementing a findFile method to find the file. This
1818
* allows using it as a wrapper around the other loaders of the component (the
1919
* ClassLoader and the UniversalClassLoader for instance) but also around any
20-
* other autoloader following this convention (the Composer one for instance)
20+
* other autoloaders following this convention (the Composer one for instance).
21+
*
22+
* // with a Symfony autoloader
23+
* use Symfony\Component\ClassLoader\ClassLoader;
2124
*
2225
* $loader = new ClassLoader();
26+
* $loader->addPrefix('Symfony\Component', __DIR__.'/component');
27+
* $loader->addPrefix('Symfony', __DIR__.'/framework');
28+
*
29+
* // or with a Composer autoloader
30+
* use Composer\Autoload\ClassLoader;
2331
*
24-
* // register classes with namespaces
32+
* $loader = new ClassLoader();
2533
* $loader->add('Symfony\Component', __DIR__.'/component');
2634
* $loader->add('Symfony', __DIR__.'/framework');
2735
*

0 commit comments

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