fixed issues with php8-named-arguments

master v3.15.2
n0nag0n 2 weeks ago
parent 62f31d7856
commit 0abf1b9b16

@ -266,9 +266,9 @@ class Engine
/** /**
* Registers the container handler * Registers the container handler
* *
* @template T of object
*
* @param ContainerInterface|callable(class-string<T> $id, array<int|string, mixed> $params): ?T $containerHandler Callback function or PSR-11 Container object that sets the container and how it will inject classes * @param ContainerInterface|callable(class-string<T> $id, array<int|string, mixed> $params): ?T $containerHandler Callback function or PSR-11 Container object that sets the container and how it will inject classes
*
* @template T of object
*/ */
public function registerContainerHandler($containerHandler): void public function registerContainerHandler($containerHandler): void
{ {

@ -52,11 +52,11 @@ class Dispatcher
/** /**
* Sets the dependency injection container handler. * Sets the dependency injection container handler.
* *
* @template T of object
*
* @param ContainerInterface|(callable(class-string<T> $classString, array<int, mixed> $params): ?T) $containerHandler * @param ContainerInterface|(callable(class-string<T> $classString, array<int, mixed> $params): ?T) $containerHandler
* Dependency injection container. * Dependency injection container.
* *
* @template T of object
*
* @throws InvalidArgumentException If $containerHandler is not a `callable` or instance of `Psr\Container\ContainerInterface`. * @throws InvalidArgumentException If $containerHandler is not a `callable` or instance of `Psr\Container\ContainerInterface`.
*/ */
public function setContainerHandler($containerHandler): void public function setContainerHandler($containerHandler): void

@ -134,7 +134,8 @@ class FlightTest extends TestCase
Flight::start(); Flight::start();
} }
public function testStaticNestedGroups(): void { public function testStaticNestedGroups(): void
{
Flight::group('/', static function (): void { Flight::group('/', static function (): void {
Flight::group('/', static function (): void { Flight::group('/', static function (): void {
Flight::route('GET /', static function (): void { Flight::route('GET /', static function (): void {

@ -19,7 +19,7 @@ final class FlightTest extends TestCase
protected function setUp(): void protected function setUp(): void
{ {
$this->engine = new Engine; $this->engine = new Engine();
Flight::init(); Flight::init();
Flight::setEngine($this->engine); Flight::setEngine($this->engine);
} }
@ -27,15 +27,15 @@ final class FlightTest extends TestCase
////////////////// //////////////////
// CORE METHODS // // CORE METHODS //
////////////////// //////////////////
public function test_path(): void public function testPath(): void
{ {
Flight::path(dir: __DIR__); Flight::path(dir: __DIR__); // phpcs:ignore
$exampleObject = new ExampleClass(); $exampleObject = new ExampleClass();
self::assertInstanceOf(ExampleClass::class, $exampleObject); self::assertInstanceOf(ExampleClass::class, $exampleObject);
} }
public function test_stop_with_code(): void public function testStopWithCode(): void
{ {
Flight::stop(code: 500); Flight::stop(code: 500);
@ -43,7 +43,7 @@ final class FlightTest extends TestCase
self::assertSame(500, Flight::response()->status()); self::assertSame(500, Flight::response()->status());
} }
public function test_halt(): void public function testHalt(): void
{ {
Flight::halt(actuallyExit: false, code: 500, message: 'Test'); Flight::halt(actuallyExit: false, code: 500, message: 'Test');
@ -51,7 +51,7 @@ final class FlightTest extends TestCase
self::assertSame(500, Flight::response()->status()); self::assertSame(500, Flight::response()->status());
} }
public function test_register(): void public function testRegister(): void
{ {
Flight::register( Flight::register(
class: stdClass::class, class: stdClass::class,
@ -71,11 +71,11 @@ final class FlightTest extends TestCase
Flight::unregister(methodName: 'customClass'); Flight::unregister(methodName: 'customClass');
} }
public function test_register_container(): void public function testRegisterContainer(): void
{ {
$dateTime = new DateTimeImmutable(); $dateTime = new DateTimeImmutable();
$controller = new class($dateTime) { $controller = new class ($dateTime) {
public function __construct(private DateTimeImmutable $dateTime) public function __construct(private DateTimeImmutable $dateTime)
{ {
// //
@ -108,7 +108,7 @@ final class FlightTest extends TestCase
///////////////////// /////////////////////
// ROUTING METHODS // // ROUTING METHODS //
///////////////////// /////////////////////
public function test_static_route(): void public function testStaticRoute(): void
{ {
Flight::request()->url = '/test'; Flight::request()->url = '/test';

Loading…
Cancel
Save