Skip to content

Commit bc5211e

Browse files
committed
RespondEvent requires a Response
1 parent 69ce84c commit bc5211e

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

lib/Responder/WithEvent.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?php
22

3-
/*
4-
* This file is part of the ICanBoogie package.
5-
*
6-
* (c) Olivier Laviale <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
namespace ICanBoogie\HTTP\Responder;
134

145
use ICanBoogie\HTTP\Request;
@@ -22,10 +13,10 @@
2213
/**
2314
* Decorates a {@see Responder} with {@see BeforeRespondEvent} and {@see RespondEvent}.
2415
*/
25-
final class WithEvent implements Responder
16+
final readonly class WithEvent implements Responder
2617
{
2718
public function __construct(
28-
private readonly Responder $responder
19+
private Responder $responder
2920
) {
3021
}
3122

lib/Responder/WithEvent/BeforeRespondEvent.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020
*/
2121
class BeforeRespondEvent extends Event
2222
{
23-
public ?Response $response;
24-
2523
public function __construct(
2624
public readonly Request $request,
27-
?Response &$response = null
25+
public ?Response &$response = null
2826
) {
29-
$this->response = &$response;
30-
3127
parent::__construct();
3228
}
3329
}

lib/Responder/WithEvent/RespondEvent.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020
*/
2121
class RespondEvent extends Event
2222
{
23-
public ?Response $response;
24-
2523
public function __construct(
2624
public readonly Request $request,
27-
?Response &$response = null
25+
public Response &$response,
2826
) {
29-
$this->response = &$response;
30-
3127
parent::__construct();
3228
}
3329
}

0 commit comments

Comments
 (0)