Skip to content

Commit

Permalink
RespondEvent requires a Response
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 17, 2024
1 parent 69ce84c commit bc5211e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
13 changes: 2 additions & 11 deletions lib/Responder/WithEvent.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace ICanBoogie\HTTP\Responder;

use ICanBoogie\HTTP\Request;
Expand All @@ -22,10 +13,10 @@
/**
* Decorates a {@see Responder} with {@see BeforeRespondEvent} and {@see RespondEvent}.
*/
final class WithEvent implements Responder
final readonly class WithEvent implements Responder
{
public function __construct(
private readonly Responder $responder
private Responder $responder
) {
}

Expand Down
6 changes: 1 addition & 5 deletions lib/Responder/WithEvent/BeforeRespondEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@
*/
class BeforeRespondEvent extends Event
{
public ?Response $response;

public function __construct(
public readonly Request $request,
?Response &$response = null
public ?Response &$response = null
) {
$this->response = &$response;

parent::__construct();
}
}
6 changes: 1 addition & 5 deletions lib/Responder/WithEvent/RespondEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@
*/
class RespondEvent extends Event
{
public ?Response $response;

public function __construct(
public readonly Request $request,
?Response &$response = null
public Response &$response,
) {
$this->response = &$response;

parent::__construct();
}
}

0 comments on commit bc5211e

Please sign in to comment.