Skip to content

Conversation

@vjik
Copy link
Member

@vjik vjik commented Sep 3, 2025

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

Comment on lines +34 to +36
$this->methodFailureHandler = $methodFailureHandler === false
? null
: $methodFailureHandler ?? new StandardMethodFailureHandler($responseFactory);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. What's the goal of not having any handler?
  2. Ternary condition here is hardly readable. Better to split it.

use Yiisoft\Http\Method;
use Yiisoft\Http\Status;

final class StandardMethodFailureHandler implements MethodFailureHandlerInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final class StandardMethodFailureHandler implements MethodFailureHandlerInterface
final class DefaultMethodFailureHandler implements MethodFailureHandlerInterface

@samdark
Copy link
Member

samdark commented Sep 4, 2025

Related: #266

The difference from #266 is that:

  1. Default handler is set automatically without DI. That allows easier usage w/o Yii3 👍
  2. There's a way not to set any handler (what for? 🤔)

@olegbaturin
Copy link

olegbaturin commented Sep 8, 2025

Related: #266

The difference from #266 is that:

  1. Default handler is set automatically without DI. That allows easier usage w/o Yii3 👍

It's optional behavior, 405 is neither required, nor recommended, it depends on application.

  1. There's a way not to set any handler (what for? 🤔)

According to rfc code can be 404

The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants