From 1ac33a5d27dd4a6f55db68351101a40afa8cc15e Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Wed, 1 Apr 2026 03:43:58 -0400 Subject: [PATCH] minor docblock refactors --- src/Engine.php | 18 +++++++++--------- src/Flight.php | 19 ++++++++----------- src/core/Dispatcher.php | 4 +--- src/core/Loader.php | 2 +- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/Engine.php b/src/Engine.php index f44da07..3c642be 100644 --- a/src/Engine.php +++ b/src/Engine.php @@ -32,16 +32,16 @@ use Psr\Container\ContainerInterface; * @method void stop(?int $code = null) * @method void halt(int $code = 200, string $message = '', bool $actuallyExit = true) * @method EventDispatcher eventDispatcher() - * @method Route route(string $pattern, callable|string|array $callback, bool $pass_route = false, string $alias = '') - * @method void group(string $pattern, callable $callback, array $group_middlewares = []) - * @method Route post(string $pattern, callable|string|array $callback, bool $pass_route = false, string $alias = '') - * @method Route put(string $pattern, callable|string|array $callback, bool $pass_route = false, string $alias = '') - * @method Route patch(string $pattern, callable|string|array $callback, bool $pass_route = false, string $alias = '') - * @method Route delete(string $pattern, callable|string|array $callback, bool $pass_route = false, string $alias = '') - * @method void resource(string $pattern, string $controllerClass, array $methods = []) + * @method Route route(string $pattern, callable|string|array{0: class-string, 1: string} $callback, bool $pass_route = false, string $alias = '') + * @method void group(string $pattern, callable $callback, array $group_middlewares = []) + * @method Route post(string $pattern, callable|string|array{0: class-string, 1: string} $callback, bool $pass_route = false, string $alias = '') + * @method Route put(string $pattern, callable|string|array{0: class-string, 1: string} $callback, bool $pass_route = false, string $alias = '') + * @method Route patch(string $pattern, callable|string|array{0: class-string, 1: string} $callback, bool $pass_route = false, string $alias = '') + * @method Route delete(string $pattern, callable|string|array{0: class-string, 1: string} $callback, bool $pass_route = false, string $alias = '') + * @method void resource(string $pattern, class-string $controllerClass, array> $methods = []) * @method Router router() - * @method string getUrl(string $alias) - * @method void render(string $file, array $data = null, string $key = null) + * @method string getUrl(string $alias, array $params) + * @method void render(string $file, ?array $data, string $key = null) * @method View view() * @method void onEvent(string $event, callable $callback) * @method void triggerEvent(string $event, ...$args) diff --git a/src/Flight.php b/src/Flight.php index 65af58f..0752ab4 100644 --- a/src/Flight.php +++ b/src/Flight.php @@ -206,7 +206,7 @@ class Flight self::app()->clear($key); } - /** @param array $data */ + /** @param ?array $data */ public static function render(string $file, ?array $data = null, ?string $key = null): void { self::app()->render($file, $data, $key); @@ -222,7 +222,7 @@ class Flight self::app()->onEvent($event, $callback); } - /** @param ...mixed $args */ + /** @param mixed ...$args */ public static function triggerEvent(string $event, ...$args): void { self::app()->triggerEvent($event, ...$args); @@ -249,10 +249,9 @@ class Flight int $code = 200, bool $encode = true, string $charset = 'utf8', - int $encodeOption = 0, - int $encodeDepth = 512 + int $encodeOption = 0 ): void { - self::app()->json($data, $code, $encode, $charset, $encodeOption, $encodeDepth); + self::app()->json($data, $code, $encode, $charset, $encodeOption); } /** @param mixed $data */ @@ -261,10 +260,9 @@ class Flight int $code = 200, bool $encode = true, string $charset = 'utf8', - int $encodeOption = 0, - int $encodeDepth = 512 + int $encodeOption = 0 ): void { - self::app()->jsonHalt($data, $code, $encode, $charset, $encodeOption, $encodeDepth); + self::app()->jsonHalt($data, $code, $encode, $charset, $encodeOption); } /** @param mixed $data */ @@ -274,10 +272,9 @@ class Flight int $code = 200, bool $encode = true, string $charset = 'utf8', - int $encodeOption = 0, - int $encodeDepth = 512 + int $encodeOption = 0 ): void { - self::app()->jsonp($data, $param, $code, $encode, $charset, $encodeOption, $encodeDepth); + self::app()->jsonp($data, $param, $code, $encode, $charset, $encodeOption); } public static function error(Throwable $exception): void diff --git a/src/core/Dispatcher.php b/src/core/Dispatcher.php index 12f3393..1f26588 100644 --- a/src/core/Dispatcher.php +++ b/src/core/Dispatcher.php @@ -18,9 +18,8 @@ use TypeError; * allows you to hook other functions to an event that can modify the * input parameters and/or the output. * - * @license MIT, http://flightphp.com/license + * @license MIT, https://docs.flightphp.com/license/ * @copyright Copyright (c) 2011, Mike Cao - * @phpstan-template EngineTemplate of object */ class Dispatcher { @@ -30,7 +29,6 @@ class Dispatcher /** Exception message if thrown by setting the container as a callable method. */ protected ?Throwable $containerException = null; - /** @var ?Engine $engine Engine instance. */ protected ?Engine $engine = null; /** @var array Mapped events. */ diff --git a/src/core/Loader.php b/src/core/Loader.php index c9656f1..bb0ad41 100644 --- a/src/core/Loader.php +++ b/src/core/Loader.php @@ -9,7 +9,7 @@ use Throwable; /** * The Loader class is responsible for loading objects. It maintains a list of * reusable class instances and can generate a new class instances with custom - * initialization parameters. It also performs class autoloading. + * initialization parameters. * @license MIT, https://docs.flightphp.com/license/ * @copyright Copyright (c) 2011, Mike Cao */