Skip to content

Commit c3ec01e

Browse files
committed
#135 deprecating most of the AnnotationRegistry API, which should just be using the internal autoloader
1 parent 17e4de9 commit c3ec01e

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

lib/Doctrine/Common/Annotations/AnnotationRegistry.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public static function reset()
6363
/**
6464
* Registers file.
6565
*
66-
* @param string $file
67-
*
68-
* @return void
66+
* @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
67+
* autoloading should be deferred to the globally registered autoloader by then. For now,
68+
* use @example AnnotationRegistry::registerLoader('class_exists')
6969
*/
70-
public static function registerFile($file)
70+
public static function registerFile(string $file) : void
7171
{
7272
require_once $file;
7373
}
@@ -80,9 +80,11 @@ public static function registerFile($file)
8080
* @param string $namespace
8181
* @param string|array|null $dirs
8282
*
83-
* @return void
83+
* @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
84+
* autoloading should be deferred to the globally registered autoloader by then. For now,
85+
* use @example AnnotationRegistry::registerLoader('class_exists')
8486
*/
85-
public static function registerAutoloadNamespace($namespace, $dirs = null)
87+
public static function registerAutoloadNamespace(string $namespace, $dirs = null) : void
8688
{
8789
self::$autoloadNamespaces[$namespace] = $dirs;
8890
}
@@ -92,11 +94,13 @@ public static function registerAutoloadNamespace($namespace, $dirs = null)
9294
*
9395
* Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
9496
*
95-
* @param array $namespaces
97+
* @param string[][]|string[]|null[] $namespaces indexed by namespace name
9698
*
97-
* @return void
99+
* @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
100+
* autoloading should be deferred to the globally registered autoloader by then. For now,
101+
* use @example AnnotationRegistry::registerLoader('class_exists')
98102
*/
99-
public static function registerAutoloadNamespaces(array $namespaces)
103+
public static function registerAutoloadNamespaces(array $namespaces) : void
100104
{
101105
self::$autoloadNamespaces = \array_merge(self::$autoloadNamespaces, $namespaces);
102106
}
@@ -107,17 +111,11 @@ public static function registerAutoloadNamespaces(array $namespaces)
107111
* NOTE: These class loaders HAVE to be silent when a class was not found!
108112
* IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class.
109113
*
110-
* @param callable $callable
111-
*
112-
* @return void
113-
*
114-
* @throws \InvalidArgumentException
115-
*
116114
* @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
117115
* autoloading should be deferred to the globally registered autoloader by then. For now,
118116
* use @example AnnotationRegistry::registerLoader('class_exists')
119117
*/
120-
public static function registerLoader(callable $callable)
118+
public static function registerLoader(callable $callable) : void
121119
{
122120
// Reset our static cache now that we have a new loader to work with
123121
self::$failedToAutoload = [];
@@ -140,6 +138,7 @@ public static function loadAnnotationClass(string $class) : bool
140138
foreach (self::$autoloadNamespaces AS $namespace => $dirs) {
141139
if (\strpos($class, $namespace) === 0) {
142140
$file = \str_replace('\\', \DIRECTORY_SEPARATOR, $class) . '.php';
141+
143142
if ($dirs === null) {
144143
if ($path = stream_resolve_include_path($file)) {
145144
require $path;

0 commit comments

Comments
 (0)