-
Notifications
You must be signed in to change notification settings - Fork 6
Issue #384: Refactored handlers #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: alexmerlin <[email protected]>
Signed-off-by: alexmerlin <[email protected]>
…thod Signed-off-by: alexmerlin <[email protected]>
|
@MarioRadu If you could take a look especially at my modifications in test/Unit/App/Middleware/DeprecationMiddlewareTest.php where I removed |
Signed-off-by: alexmerlin <[email protected]>
|
The issues reported by Qodana are false-positive errors. The errors are not thrown directly from the code in the |
I've seen the changes and they should be fine. |
| */ | ||
| public function handle(ServerRequestInterface $request): ResponseInterface | ||
| { | ||
| $inputFilter = (new CreateAdminInputFilter())->setData((array) $request->getParsedBody()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we initialize the input filters in the constructor? Creating them on the fly it's not fully testable because you can't mock them.
(this comment applies to all input filters)
I'm thinking of something like this :
class PostAdminResourceHandler extends AbstractHandler
{
#[Inject(
AdminServiceInterface::class,
CreateAdminInputFilter::class,
)]
public function __construct(
protected AdminServiceInterface $adminService,
protected CreateAdminInputFilter $inputFilter,
) {
}
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->inputFilter->setData((array) $request->getParsedBody());
....
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! 👍
Will implement it in a different PR.

No description provided.