@@ -15,23 +15,23 @@ discard block |
||
15 | 15 | class StaticMethodCollectorTest extends Base |
16 | 16 | { |
17 | 17 | /** |
18 | - * @var bool |
|
19 | - */ |
|
18 | + * @var bool |
|
19 | + */ |
|
20 | 20 | protected $backupGlobals = false; |
21 | 21 | |
22 | 22 | /** |
23 | - * @var bool |
|
24 | - */ |
|
23 | + * @var bool |
|
24 | + */ |
|
25 | 25 | protected $backupStaticAttributes = false; |
26 | 26 | |
27 | 27 | /** |
28 | - * @var bool |
|
29 | - */ |
|
28 | + * @var bool |
|
29 | + */ |
|
30 | 30 | protected $runTestInSeparateProcess = false; |
31 | 31 | |
32 | 32 | /** |
33 | - * @return Generator<int, array{0:array<class-string, array<string, array<int, class-string>>>, 1:array<int, class-string>, 2:array<int, class-string>, 3:class-string}, mixed, void> |
|
34 | - */ |
|
33 | + * @return Generator<int, array{0:array<class-string, array<string, array<int, class-string>>>, 1:array<int, class-string>, 2:array<int, class-string>, 3:class-string}, mixed, void> |
|
34 | + */ |
|
35 | 35 | public function DataProviderCollection() : Generator |
36 | 36 | { |
37 | 37 | yield from [ |
@@ -60,26 +60,26 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @return Generator<int, array{0:bool, 1:array<class-string, array<string, array<int, class-string>>>, 2:array<int, class-string>, 3:array<int, class-string>, 4:class-string}, mixed, void> |
|
64 | - */ |
|
63 | + * @return Generator<int, array{0:bool, 1:array<class-string, array<string, array<int, class-string>>>, 2:array<int, class-string>, 3:array<int, class-string>, 4:class-string}, mixed, void> |
|
64 | + */ |
|
65 | 65 | public function DataProviderCollectionToggle() : Generator |
66 | 66 | { |
67 | 67 | /** |
68 | - * @var iterable<array<int, scalar|array>> |
|
69 | - */ |
|
68 | + * @var iterable<array<int, scalar|array>> |
|
69 | + */ |
|
70 | 70 | $sources = $this->DataProviderCollection(); |
71 | 71 | |
72 | 72 | foreach ($sources as $args) { |
73 | 73 | /** |
74 | - * @var array{0:true, 1:array<class-string, array<string, array<int, class-string>>>, 2:array<int, class-string>, 3:array<int, class-string>, 4:class-string} |
|
75 | - */ |
|
74 | + * @var array{0:true, 1:array<class-string, array<string, array<int, class-string>>>, 2:array<int, class-string>, 3:array<int, class-string>, 4:class-string} |
|
75 | + */ |
|
76 | 76 | $out = array_merge([true], $args); |
77 | 77 | |
78 | 78 | yield $out; |
79 | 79 | |
80 | 80 | /** |
81 | - * @var array{0:false, 1:array<class-string, array<string, array<int, class-string>>>, 2:array<int, class-string>, 3:array<int, class-string>, 4:class-string} |
|
82 | - */ |
|
81 | + * @var array{0:false, 1:array<class-string, array<string, array<int, class-string>>>, 2:array<int, class-string>, 3:array<int, class-string>, 4:class-string} |
|
82 | + */ |
|
83 | 83 | $out = array_merge([false], $args); |
84 | 84 | |
85 | 85 | yield $out; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @param array<class-string, array<string, array<int, class-string>>> $staticMethods |
|
91 | - * @param array<int, class-string> $interfaces |
|
92 | - * @param class-string ...$implementations |
|
93 | - * |
|
94 | - * @dataProvider DataProviderCollectionToggle |
|
95 | - */ |
|
90 | + * @param array<class-string, array<string, array<int, class-string>>> $staticMethods |
|
91 | + * @param array<int, class-string> $interfaces |
|
92 | + * @param class-string ...$implementations |
|
93 | + * |
|
94 | + * @dataProvider DataProviderCollectionToggle |
|
95 | + */ |
|
96 | 96 | public function testCollection( |
97 | 97 | bool $semiResetting, |
98 | 98 | array $staticMethods, |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * @param array<class-string, array<string, array<int, class-string>>> $staticMethods |
|
123 | - * @param array<int, class-string> $interfaces |
|
124 | - * @param array<int, class-string> $expectedResult |
|
125 | - * @param string ...$implementations |
|
126 | - * |
|
127 | - * @psalm-param class-string ...$implementations |
|
128 | - * |
|
129 | - * @dataProvider DataProviderCollectionToggle |
|
130 | - */ |
|
122 | + * @param array<class-string, array<string, array<int, class-string>>> $staticMethods |
|
123 | + * @param array<int, class-string> $interfaces |
|
124 | + * @param array<int, class-string> $expectedResult |
|
125 | + * @param string ...$implementations |
|
126 | + * |
|
127 | + * @psalm-param class-string ...$implementations |
|
128 | + * |
|
129 | + * @dataProvider DataProviderCollectionToggle |
|
130 | + */ |
|
131 | 131 | public function testCollectionWithoutResettingProcessedSources( |
132 | 132 | bool $semiResetting, |
133 | 133 | array $staticMethods, |
@@ -13,11 +13,11 @@ |
||
13 | 13 | class PublicCollectInterfacesFromImplementationTypes extends Base |
14 | 14 | { |
15 | 15 | /** |
16 | - * @param class-string $implementation |
|
17 | - * @param array<int, class-string> $types |
|
18 | - * |
|
19 | - * @return Generator<int, class-string, mixed, void> |
|
20 | - */ |
|
16 | + * @param class-string $implementation |
|
17 | + * @param array<int, class-string> $types |
|
18 | + * |
|
19 | + * @return Generator<int, class-string, mixed, void> |
|
20 | + */ |
|
21 | 21 | public function PublicCollectInterfacesFromImplementationTypes( |
22 | 22 | string $implementation, |
23 | 23 | string $method, |
@@ -16,8 +16,8 @@ |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | - * @return array<int, string> URI prefixes |
|
20 | - */ |
|
19 | + * @return array<int, string> URI prefixes |
|
20 | + */ |
|
21 | 21 | public static function DaftRouterRoutePrefixExceptions() : array |
22 | 22 | { |
23 | 23 | return []; |
@@ -11,14 +11,14 @@ |
||
11 | 11 | public static function DaftRouterHandleRequest(Request $request, array $args) : Response; |
12 | 12 | |
13 | 13 | /** |
14 | - * @return array<string, array<int, string>> an array of URIs & methods |
|
15 | - */ |
|
14 | + * @return array<string, array<int, string>> an array of URIs & methods |
|
15 | + */ |
|
16 | 16 | public static function DaftRouterRoutes() : array; |
17 | 17 | |
18 | 18 | /** |
19 | - * @param array<string, scalar> $args |
|
20 | - * |
|
21 | - * @throws \InvalidArgumentException if no uri could be found |
|
22 | - */ |
|
19 | + * @param array<string, scalar> $args |
|
20 | + * |
|
21 | + * @throws \InvalidArgumentException if no uri could be found |
|
22 | + */ |
|
23 | 23 | public static function DaftRouterHttpRoute(array $args, string $method = 'GET') : string; |
24 | 24 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | ) : ? Response; |
15 | 15 | |
16 | 16 | /** |
17 | - * @return array<int, string> URI prefixes |
|
18 | - */ |
|
17 | + * @return array<int, string> URI prefixes |
|
18 | + */ |
|
19 | 19 | public static function DaftRouterRoutePrefixExceptions() : array; |
20 | 20 | } |
@@ -9,9 +9,9 @@ |
||
9 | 9 | interface DaftSource |
10 | 10 | { |
11 | 11 | /** |
12 | - * Provides an array of DaftRoute, DaftMiddleware, or DaftSource implementations. |
|
13 | - * |
|
14 | - * @return array<int, string> |
|
15 | - */ |
|
12 | + * Provides an array of DaftRoute, DaftMiddleware, or DaftSource implementations. |
|
13 | + * |
|
14 | + * @return array<int, string> |
|
15 | + */ |
|
16 | 16 | public static function DaftRouterRouteAndMiddlewareSources() : array; |
17 | 17 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | class SemiResettingStaticMethodCollector extends Base |
13 | 13 | { |
14 | 14 | /** |
15 | - * @param class-string ...$implementations |
|
16 | - */ |
|
15 | + * @param class-string ...$implementations |
|
16 | + */ |
|
17 | 17 | public function Collect(string ...$implementations) : Generator |
18 | 18 | { |
19 | 19 | if ($this->autoReset) { |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | const EXPECTED_NUMBER_OF_REQUIRED_PARAMETERS = 0; |
28 | 28 | |
29 | 29 | /** |
30 | - * @var array<int, class-string> |
|
31 | - */ |
|
30 | + * @var array<int, class-string> |
|
31 | + */ |
|
32 | 32 | protected $processedSources = []; |
33 | 33 | |
34 | 34 | /** |
35 | - * @var array<int, class-string> |
|
36 | - */ |
|
35 | + * @var array<int, class-string> |
|
36 | + */ |
|
37 | 37 | protected $alreadyYielded = []; |
38 | 38 | |
39 | 39 | /** |
40 | - * @var bool |
|
41 | - */ |
|
40 | + * @var bool |
|
41 | + */ |
|
42 | 42 | protected $autoReset; |
43 | 43 | |
44 | 44 | /** |
45 | - * @var array<class-string, array<string, array<int, class-string>>> |
|
46 | - */ |
|
45 | + * @var array<class-string, array<string, array<int, class-string>>> |
|
46 | + */ |
|
47 | 47 | private $staticMethods = []; |
48 | 48 | |
49 | 49 | /** |
50 | - * @var array<int, class-string> |
|
51 | - */ |
|
50 | + * @var array<int, class-string> |
|
51 | + */ |
|
52 | 52 | private $interfaces = []; |
53 | 53 | |
54 | 54 | /** |
55 | - * @param array<class-string, array<string, array<int, class-string>>> $staticMethods |
|
56 | - * @param array<int, class-string> $interfaces |
|
57 | - */ |
|
55 | + * @param array<class-string, array<string, array<int, class-string>>> $staticMethods |
|
56 | + * @param array<int, class-string> $interfaces |
|
57 | + */ |
|
58 | 58 | public function __construct( |
59 | 59 | array $staticMethods, |
60 | 60 | array $interfaces, |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * @param class-string ...$implementations |
|
78 | - * |
|
79 | - * @return Generator<int, class-string, mixed, void> |
|
80 | - */ |
|
77 | + * @param class-string ...$implementations |
|
78 | + * |
|
79 | + * @return Generator<int, class-string, mixed, void> |
|
80 | + */ |
|
81 | 81 | public function Collect(string ...$implementations) : Generator |
82 | 82 | { |
83 | 83 | if ($this->autoReset) { |
@@ -89,18 +89,18 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
92 | - * @param class-string ...$implementations |
|
93 | - * |
|
94 | - * @return Generator<int, class-string, mixed, void> |
|
95 | - */ |
|
92 | + * @param class-string ...$implementations |
|
93 | + * |
|
94 | + * @return Generator<int, class-string, mixed, void> |
|
95 | + */ |
|
96 | 96 | protected function CollectInterfaces(string ...$implementations) : Generator |
97 | 97 | { |
98 | 98 | foreach ( |
99 | 99 | array_filter( |
100 | 100 | $implementations, |
101 | 101 | /** |
102 | - * @param class-string $implementation |
|
103 | - */ |
|
102 | + * @param class-string $implementation |
|
103 | + */ |
|
104 | 104 | function (string $implementation) : bool { |
105 | 105 | return |
106 | 106 | ! static::IsStringInArray($implementation, $this->processedSources); |
@@ -114,20 +114,20 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * @template T as object |
|
118 | - * |
|
119 | - * @param class-string<T> $implementation |
|
120 | - * |
|
121 | - * @return Generator<int, class-string<T>, mixed, void> |
|
122 | - */ |
|
117 | + * @template T as object |
|
118 | + * |
|
119 | + * @param class-string<T> $implementation |
|
120 | + * |
|
121 | + * @return Generator<int, class-string<T>, mixed, void> |
|
122 | + */ |
|
123 | 123 | final protected function CollectInterfacesFromImplementationCheckInterfaces( |
124 | 124 | string $implementation |
125 | 125 | ) : Generator { |
126 | 126 | $checking = array_filter( |
127 | 127 | $this->interfaces, |
128 | 128 | /** |
129 | - * @param class-string $interface |
|
130 | - */ |
|
129 | + * @param class-string $interface |
|
130 | + */ |
|
131 | 131 | function (string $interface) use ($implementation) : bool { |
132 | 132 | return static::IsStringA($implementation, $interface); |
133 | 133 | } |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | - * @param class-string $implementation |
|
147 | - * |
|
148 | - * @return Generator<int, class-string, mixed, void> |
|
149 | - */ |
|
146 | + * @param class-string $implementation |
|
147 | + * |
|
148 | + * @return Generator<int, class-string, mixed, void> |
|
149 | + */ |
|
150 | 150 | final protected function CollectInterfacesFromImplementation(string $implementation) : Generator |
151 | 151 | { |
152 | 152 | $interfaces = array_keys($this->staticMethods); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * @param class-string $implementation |
|
167 | - * @param array<int, class-string> $types |
|
168 | - * |
|
169 | - * @return Generator<int, class-string, mixed, void> |
|
170 | - */ |
|
166 | + * @param class-string $implementation |
|
167 | + * @param array<int, class-string> $types |
|
168 | + * |
|
169 | + * @return Generator<int, class-string, mixed, void> |
|
170 | + */ |
|
171 | 171 | final protected function CollectInterfacesFromImplementationTypes( |
172 | 172 | string $implementation, |
173 | 173 | string $method, |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * @var iterable<class-string> |
|
186 | - */ |
|
185 | + * @var iterable<class-string> |
|
186 | + */ |
|
187 | 187 | $methodResult = $implementation::$method(); |
188 | 188 | |
189 | 189 | foreach ($methodResult as $result) { |
@@ -201,20 +201,20 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
204 | - * @template T |
|
205 | - * |
|
206 | - * @param T::class $implementation |
|
207 | - * @param array<int, class-string> $interfaces |
|
208 | - * |
|
209 | - * @return array<int, T::class> |
|
210 | - */ |
|
204 | + * @template T |
|
205 | + * |
|
206 | + * @param T::class $implementation |
|
207 | + * @param array<int, class-string> $interfaces |
|
208 | + * |
|
209 | + * @return array<int, T::class> |
|
210 | + */ |
|
211 | 211 | final protected function FilterIsA(string $implementation, array $interfaces) : array |
212 | 212 | { |
213 | 213 | return array_filter( |
214 | 214 | $interfaces, |
215 | 215 | /** |
216 | - * @param class-string $interface |
|
217 | - */ |
|
216 | + * @param class-string $interface |
|
217 | + */ |
|
218 | 218 | function (string $interface) use ($implementation) : bool { |
219 | 219 | return static::IsStringA($implementation, $interface); |
220 | 220 | } |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
225 | - * @param array<int, class-string> $interfaces |
|
226 | - * |
|
227 | - * @return array<int, class-string> |
|
228 | - */ |
|
225 | + * @param array<int, class-string> $interfaces |
|
226 | + * |
|
227 | + * @return array<int, class-string> |
|
228 | + */ |
|
229 | 229 | final protected function FilterArrayOfInterfacesOrClasses(array $interfaces) : array |
230 | 230 | { |
231 | 231 | /** |
232 | - * @var array<int, class-string> |
|
233 | - */ |
|
232 | + * @var array<int, class-string> |
|
233 | + */ |
|
234 | 234 | $strings = array_filter( |
235 | 235 | $interfaces, |
236 | 236 | function (string $maybe) : bool { |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
245 | - * @param array<class-string, array<string, array<int, class-string>>> $interfaces |
|
246 | - * |
|
247 | - * @return array<class-string, array<string, array<int, class-string>>> |
|
248 | - */ |
|
245 | + * @param array<class-string, array<string, array<int, class-string>>> $interfaces |
|
246 | + * |
|
247 | + * @return array<class-string, array<string, array<int, class-string>>> |
|
248 | + */ |
|
249 | 249 | final protected function FilterArrayOfInterfaceOffsets(array $interfaces) : array |
250 | 250 | { |
251 | 251 | return array_filter( |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * @param class-string $interface |
|
262 | - */ |
|
261 | + * @param class-string $interface |
|
262 | + */ |
|
263 | 263 | final protected function MakeMethodFilter(string $interface) : Closure |
264 | 264 | { |
265 | 265 | return function (string $maybe) use ($interface) : bool { |
@@ -283,24 +283,24 @@ discard block |
||
283 | 283 | final protected function FilterReflectionReturnType(? ReflectionType $refReturn) : bool |
284 | 284 | { |
285 | 285 | /** |
286 | - * @var string|class-string |
|
287 | - */ |
|
286 | + * @var string|class-string |
|
287 | + */ |
|
288 | 288 | $refReturnName = ($refReturn instanceof ReflectionNamedType) ? $refReturn->getName() : ''; |
289 | 289 | |
290 | 290 | return 'array' === $refReturnName || static::IsStringA($refReturnName, Traversable::class); |
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
294 | - * @param class-string $interface |
|
295 | - * @param array<string, array<int, class-string>> $methods |
|
296 | - * |
|
297 | - * @return array<class-string, string[]> |
|
298 | - */ |
|
294 | + * @param class-string $interface |
|
295 | + * @param array<string, array<int, class-string>> $methods |
|
296 | + * |
|
297 | + * @return array<class-string, string[]> |
|
298 | + */ |
|
299 | 299 | final protected function FilterMethods(string $interface, array $methods) : array |
300 | 300 | { |
301 | 301 | /** |
302 | - * @var array<class-string, string[]> |
|
303 | - */ |
|
302 | + * @var array<class-string, string[]> |
|
303 | + */ |
|
304 | 304 | $filteredMethods = $this->FilterNonZeroArray(array_map( |
305 | 305 | [$this, 'FilterArrayOfInterfacesOrClasses'], |
306 | 306 | array_filter( |
@@ -314,13 +314,13 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | - * @return array<class-string, array<string, array<int, class-string>>> |
|
318 | - */ |
|
317 | + * @return array<class-string, array<string, array<int, class-string>>> |
|
318 | + */ |
|
319 | 319 | final protected function FilterNonZeroArray(array $in) : array |
320 | 320 | { |
321 | 321 | /** |
322 | - * @var array<class-string, array<string, array<int, class-string>>> |
|
323 | - */ |
|
322 | + * @var array<class-string, array<string, array<int, class-string>>> |
|
323 | + */ |
|
324 | 324 | $out = array_filter( |
325 | 325 | $in, |
326 | 326 | function (array $val) : bool { |
@@ -332,17 +332,17 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
335 | - * @param class-string $maybe |
|
336 | - * @param class-string[] $array |
|
337 | - */ |
|
335 | + * @param class-string $maybe |
|
336 | + * @param class-string[] $array |
|
337 | + */ |
|
338 | 338 | protected static function IsStringInArray(string $maybe, array $array) : bool |
339 | 339 | { |
340 | 340 | return in_array($maybe, $array, true); |
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
344 | - * @param class-string $thing |
|
345 | - */ |
|
344 | + * @param class-string $thing |
|
345 | + */ |
|
346 | 346 | protected static function IsStringA(string $maybe, string $thing) : bool |
347 | 347 | { |
348 | 348 | return is_a($maybe, $thing, true); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param class-string $implementation |
103 | 103 | */ |
104 | - function (string $implementation) : bool { |
|
104 | + function(string $implementation) : bool { |
|
105 | 105 | return |
106 | 106 | ! static::IsStringInArray($implementation, $this->processedSources); |
107 | 107 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @param class-string $interface |
130 | 130 | */ |
131 | - function (string $interface) use ($implementation) : bool { |
|
131 | + function(string $interface) use ($implementation) : bool { |
|
132 | 132 | return static::IsStringA($implementation, $interface); |
133 | 133 | } |
134 | 134 | ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | /** |
216 | 216 | * @param class-string $interface |
217 | 217 | */ |
218 | - function (string $interface) use ($implementation) : bool { |
|
218 | + function(string $interface) use ($implementation) : bool { |
|
219 | 219 | return static::IsStringA($implementation, $interface); |
220 | 220 | } |
221 | 221 | ); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | $strings = array_filter( |
235 | 235 | $interfaces, |
236 | - function (string $maybe) : bool { |
|
236 | + function(string $maybe) : bool { |
|
237 | 237 | return interface_exists($maybe) || class_exists($maybe); |
238 | 238 | } |
239 | 239 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | { |
251 | 251 | return array_filter( |
252 | 252 | $interfaces, |
253 | - function (string $maybe) : bool { |
|
253 | + function(string $maybe) : bool { |
|
254 | 254 | return interface_exists($maybe); |
255 | 255 | }, |
256 | 256 | ARRAY_FILTER_USE_KEY |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | final protected function MakeMethodFilter(string $interface) : Closure |
264 | 264 | { |
265 | - return function (string $maybe) use ($interface) : bool { |
|
265 | + return function(string $maybe) use ($interface) : bool { |
|
266 | 266 | $ref = new ReflectionClass($interface); |
267 | 267 | |
268 | 268 | return |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | $out = array_filter( |
325 | 325 | $in, |
326 | - function (array $val) : bool { |
|
326 | + function(array $val) : bool { |
|
327 | 327 | return count($val) > self::INT_FILTER_NON_EMPTY_ARRAY; |
328 | 328 | } |
329 | 329 | ); |