6
6
use Http \Discovery \Exception \DiscoveryFailedException ;
7
7
use Http \Discovery \Exception \NoCandidateFoundException ;
8
8
use Http \Discovery \Exception \StrategyUnavailableException ;
9
+ use Http \Discovery \Strategy \DiscoveryStrategy ;
9
10
10
11
/**
11
12
* Registry that based find results on class existence.
@@ -19,7 +20,7 @@ abstract class ClassDiscovery
19
20
/**
20
21
* A list of strategies to find classes.
21
22
*
22
- * @var array
23
+ * @var DiscoveryStrategy[]
23
24
*/
24
25
private static $ strategies = [
25
26
Strategy \GeneratedDiscoveryStrategy::class,
@@ -130,7 +131,7 @@ private static function storeInCache($type, $class)
130
131
/**
131
132
* Set new strategies and clear the cache.
132
133
*
133
- * @param array $strategies string array of fully qualified class name to a DiscoveryStrategy
134
+ * @param string[] $strategies list of fully qualified class names that implement DiscoveryStrategy
134
135
*/
135
136
public static function setStrategies (array $ strategies )
136
137
{
@@ -151,7 +152,7 @@ public static function getStrategies(): iterable
151
152
/**
152
153
* Append a strategy at the end of the strategy queue.
153
154
*
154
- * @param string $strategy Fully qualified class name to a DiscoveryStrategy
155
+ * @param string $strategy Fully qualified class name of a DiscoveryStrategy
155
156
*/
156
157
public static function appendStrategy ($ strategy )
157
158
{
@@ -170,9 +171,6 @@ public static function prependStrategy($strategy)
170
171
self ::clearCache ();
171
172
}
172
173
173
- /**
174
- * Clear the cache.
175
- */
176
174
public static function clearCache ()
177
175
{
178
176
self ::$ cache = [];
@@ -238,14 +236,13 @@ protected static function instantiateClass($class)
238
236
}
239
237
240
238
/**
241
- * We want to do a "safe" version of PHP's "class_exists" because Magento has a bug
239
+ * We need a "safe" version of PHP's "class_exists" because Magento has a bug
242
240
* (or they call it a "feature"). Magento is throwing an exception if you do class_exists()
243
241
* on a class that ends with "Factory" and if that file does not exits.
244
242
*
245
- * This function will catch all potential exceptions and make sure it returns a boolean.
243
+ * This function catches all potential exceptions and makes sure to always return a boolean.
246
244
*
247
245
* @param string $class
248
- * @param bool $autoload
249
246
*
250
247
* @return bool
251
248
*/
0 commit comments