Skip to content

Commit

Permalink
Be explicit about internal and final components
Browse files Browse the repository at this point in the history
This allows us reclaim control over the public API and the extend of
potential future BC-breaks.

Signed-off-by: Luís Cobucci <[email protected]>
  • Loading branch information
lcobucci committed Jan 31, 2024
1 parent 329e7ae commit 11b433f
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/BadRouteException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use function sprintf;

/** @final */
class BadRouteException extends LogicException
{
public static function alreadyRegistered(string $route, string $method): self
Expand Down
1 change: 1 addition & 0 deletions src/DataGenerator/CharCountBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use function count;
use function implode;

/** @final */
class CharCountBased extends RegexBasedAbstract
{
protected function getApproxChunkSize(): int
Expand Down
1 change: 1 addition & 0 deletions src/DataGenerator/GroupCountBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use function max;
use function str_repeat;

/** @final */
class GroupCountBased extends RegexBasedAbstract
{
protected function getApproxChunkSize(): int
Expand Down
1 change: 1 addition & 0 deletions src/DataGenerator/GroupPosBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use function count;
use function implode;

/** @final */
class GroupPosBased extends RegexBasedAbstract
{
protected function getApproxChunkSize(): int
Expand Down
1 change: 1 addition & 0 deletions src/DataGenerator/MarkBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use function implode;

/** @final */
class MarkBased extends RegexBasedAbstract
{
protected function getApproxChunkSize(): int
Expand Down
2 changes: 2 additions & 0 deletions src/DataGenerator/RegexBasedAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use function round;

/**
* @internal
*
* @phpstan-import-type StaticRoutes from DataGenerator
* @phpstan-import-type DynamicRouteChunk from DataGenerator
* @phpstan-import-type DynamicRoutes from DataGenerator
Expand Down
1 change: 1 addition & 0 deletions src/Dispatcher/CharCountBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use function end;
use function preg_match;

/** @final */
class CharCountBased extends RegexBasedAbstract
{
/** @inheritDoc */
Expand Down
1 change: 1 addition & 0 deletions src/Dispatcher/GroupCountBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use function count;
use function preg_match;

/** @final */
class GroupCountBased extends RegexBasedAbstract
{
/** @inheritDoc */
Expand Down
1 change: 1 addition & 0 deletions src/Dispatcher/GroupPosBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use function assert;
use function preg_match;

/** @final */
class GroupPosBased extends RegexBasedAbstract
{
/** @inheritDoc */
Expand Down
1 change: 1 addition & 0 deletions src/Dispatcher/MarkBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use function preg_match;

/** @final */
class MarkBased extends RegexBasedAbstract
{
/** @inheritDoc */
Expand Down
2 changes: 2 additions & 0 deletions src/Dispatcher/RegexBasedAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use FastRoute\Dispatcher\Result\NotMatched;

/**
* @internal
*
* @phpstan-import-type StaticRoutes from DataGenerator
* @phpstan-import-type DynamicRouteChunk from DataGenerator
* @phpstan-import-type DynamicRouteChunks from DataGenerator
Expand Down
6 changes: 5 additions & 1 deletion src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
use function preg_match;
use function preg_quote;

/** @phpstan-import-type ExtraParameters from DataGenerator */
/**
* @internal
*
* @phpstan-import-type ExtraParameters from DataGenerator
*/
class Route

Check failure on line 15 in src/Route.php

View workflow job for this annotation

GitHub Actions / Backwards compatibility check

FastRoute\Route was marked "@internal"
{
public readonly string $regex;
Expand Down
1 change: 1 addition & 0 deletions src/RouteCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/**
* @phpstan-import-type RouteData from DataGenerator
* @phpstan-import-type ExtraParameters from DataGenerator
* @final
*/
class RouteCollector
{
Expand Down
2 changes: 2 additions & 0 deletions src/RouteParser/Std.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* Parses route strings of the following form:
*
* "/user/{name}[/{id:[0-9]+}]"
*
* @final
*/
class Std implements RouteParser
{
Expand Down

0 comments on commit 11b433f

Please sign in to comment.