Skip to content

Commit

Permalink
Deprecate initialisation functions
Browse files Browse the repository at this point in the history
Now that we have a more explicit API for that, these functions aren't
needed any longer.

Signed-off-by: Luís Cobucci <[email protected]>
  • Loading branch information
lcobucci committed Jan 30, 2024
1 parent d3de424 commit 5f86172
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ parameters:
- benchmark
- src
- test

ignoreErrors:
# We're marking this as deprecated, there's no point in alerting ourselves here...
- '#Call to deprecated function FastRoute\\(cached|simple)Dispatcher.*#'
17 changes: 15 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
use function is_string;

if (! function_exists('FastRoute\simpleDispatcher')) {
/** @param array{routeParser?: class-string<RouteParser>, dataGenerator?: class-string<DataGenerator>, dispatcher?: class-string<Dispatcher>, routeCollector?: class-string<RouteCollector>, cacheDisabled?: bool, cacheKey?: string, cacheFile?: string, cacheDriver?: class-string<Cache>|Cache} $options */
/**
* @deprecated since v2.0 and will be removed in v3.0
*
* @see FastRoute::recommendedSettings()
* @see FastRoute::disableCache()
*
* @param array{routeParser?: class-string<RouteParser>, dataGenerator?: class-string<DataGenerator>, dispatcher?: class-string<Dispatcher>, routeCollector?: class-string<RouteCollector>, cacheDisabled?: bool, cacheKey?: string, cacheFile?: string, cacheDriver?: class-string<Cache>|Cache} $options
*/
function simpleDispatcher(callable $routeDefinitionCallback, array $options = []): Dispatcher
{
return \FastRoute\cachedDispatcher(
Expand All @@ -19,7 +26,13 @@ function simpleDispatcher(callable $routeDefinitionCallback, array $options = []
);
}

/** @param array{routeParser?: class-string<RouteParser>, dataGenerator?: class-string<DataGenerator>, dispatcher?: class-string<Dispatcher>, routeCollector?: class-string<RouteCollector>, cacheDisabled?: bool, cacheKey?: string, cacheFile?: string, cacheDriver?: class-string<Cache>|Cache} $options */
/**
* @deprecated since v2.0 and will be removed in v3.0
*
* @see FastRoute::recommendedSettings()
*
* @param array{routeParser?: class-string<RouteParser>, dataGenerator?: class-string<DataGenerator>, dispatcher?: class-string<Dispatcher>, routeCollector?: class-string<RouteCollector>, cacheDisabled?: bool, cacheKey?: string, cacheFile?: string, cacheDriver?: class-string<Cache>|Cache} $options
*/
function cachedDispatcher(callable $routeDefinitionCallback, array $options = []): Dispatcher
{
$options += [
Expand Down

0 comments on commit 5f86172

Please sign in to comment.