Skip to content

Commit 641b265

Browse files
committed
Disallow empty strings as cache keys
Signed-off-by: Luís Cobucci <[email protected]>
1 parent c88b799 commit 641b265

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/FastRoute.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ final class FastRoute
2222
* @param class-string<Dispatcher> $dispatcher
2323
* @param class-string<ConfigureRoutes> $routesConfiguration
2424
* @param Cache|class-string<Cache>|null $cacheDriver
25+
* @param non-empty-string|null $cacheKey
2526
*/
2627
private function __construct(
2728
private readonly Closure $routeDefinitionCallback,
@@ -34,7 +35,10 @@ private function __construct(
3435
) {
3536
}
3637

37-
/** @param Closure(ConfigureRoutes):void $routeDefinitionCallback */
38+
/**
39+
* @param Closure(ConfigureRoutes):void $routeDefinitionCallback
40+
* @param non-empty-string $cacheKey
41+
*/
3842
public static function recommendedSettings(Closure $routeDefinitionCallback, string $cacheKey): self
3943
{
4044
return new self(
@@ -61,7 +65,10 @@ public function disableCache(): self
6165
);
6266
}
6367

64-
/** @param Cache|class-string<Cache> $driver */
68+
/**
69+
* @param Cache|class-string<Cache> $driver
70+
* @param non-empty-string $cacheKey
71+
*/
6572
public function withCache(Cache|string $driver, string $cacheKey): self
6673
{
6774
return new self(

0 commit comments

Comments
 (0)