-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for laminas-httphandlerrunner v2 series #82
Add support for laminas-httphandlerrunner v2 series #82
Conversation
- Adds `^2.1` to the list of laminas-httphandlerrunner constraints, while keeping the v1 constraint. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Extracts the `DEFAULT_PROCESS_NAME` constant into `RequestHandlerConstantsInterface`. Extracts the body of `SwooleRequestHandlerRunner` into `RequestHandlerRunnerTrait`. Updates `SwooleRequestHandlerRunner` to implement `RequestHandlerConstantsInterface` and use `RequestHandlerRunnerTrait` to define its work. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
…ests - Creates Mezzio\Swoole\RequestHandlerRunner\V2RequestHandlerRunner, which implements Laminas\HttpHandlerRunner\RequestHandlerRunnerInterface and RequestHandlerConstantsInterface, and uses the RequestHandlerRunnerTrait to create the implementation. - Extracts the SwooleRequestHandlerRunnerTest into an AbstractRequestHandlerRunnerTest, with two abstract methods, getRequestHandlerClass() and determineWhetherOrNotToSkipRequestHandlerRunnerTests(). The latter will mark tests skipped if they cannot be run for the current laminas-httphandlerrunner version. The former is used to get the class name to use for `new()` operations. - Modifies the SwooleRequestHandlerRunnerTest to extend the new AbstractRequestHandlerRunnerTest and fill out the abstract methods. - Creates a V2RequestHandlerRunnerTest that extends the new AbstractRequestHandlerRunnerTest and fills out the abstract methods. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
…NAME Switches references from SwooleRequestHandlerRunner::DEFAULT_PROCESS_NAME to RequestHandlerConstantsInterface::DEFAULT_PROCESS_NAME everywhere to ensure the references work regardless of the request handler runner version used. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
The class is now referred to as a "service"; this is done to indicate that what is fetched for that service may vary. Additionally, an informational section was added to the "How it Works" chapter to detail the updates for the version 3.6.0 release. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Most were due to the refactor to support both v1 and v2 of laminas-httphandlerrunner. When possible, I've added explicit suppressions in the Psalm configuration, as these can then be found and removed when we update implementations for v4. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
…iant Details planned changes. Updates Psalm configuration to ensure we do not see errors around deprecated classes. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
ff1e0a7
to
fa2862b
Compare
- Exclude `SwooleRequestHandlerRunnerFactory` file from scanning, as it raises an error under locked deps. - Fix issue flagged by CS Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
composer.json
Outdated
@@ -33,7 +33,7 @@ | |||
"dflydev/fig-cookies": "^2.0.1 || ^3.0", | |||
"laminas/laminas-cli": "^0.1.5 || ^1.0", | |||
"laminas/laminas-diactoros": "^1.8 || ^2.0", | |||
"laminas/laminas-httphandlerrunner": "^1.0.1", | |||
"laminas/laminas-httphandlerrunner": "^1.0.1 || ^2.1", |
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.
Didn't check the rest of the patch yet, but can we just bump to ^2.1
and drop ^1.0.1
instead please?
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.
No, we can't. It would break BC for anybody extending the SwooleRequestHandlerRunner
currently. We'd have to bump major to make it happen.
I'm only doing it here because for some reason, we bumped the minimum supported in mezzio/mezzio, so right now you cannot install mezzio-swoole against a new skeleton install. (We shouldn't have bumped in mezzio/mezzio without a major version change; the difference in what Mezzio\Application
typehints against in the constructor changed entirely, which is what is causing breakage with alternate laminas-httphandlerrunner implementations.)
I'm happy to do an immediate v4 release after this, but I think we need it in the v3 series first.
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.
Actually, been thinking on this overnight, and I think I'll just target a new major version with this change, and release 3.6 immediately with the other changes I've merged this week. WIll reduce maintenance.
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.
Done now, @Ocramius . 95% of this PR is just copying documentation for v4, so that I can add a migration guide.
Instead of doing a new minor and targeting both the v1 and v2 series of laminas-httphandlerrunner, we'll instead target just v2, and issue a new major of this library. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Since this will now target v4, I'm reverting the changes to the v3 documentation and will create v4 documentation instead. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Updates the documentation to reflect changes in v4, and rewrites the migration chapter to target v3 -> v4 migrations. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Still passes. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
@@ -19,7 +19,6 @@ | |||
use Psr\Log\LoggerInterface; | |||
use ReflectionProperty; | |||
use Webmozart\Assert\Assert; | |||
use Zend\Expressive\Swoole\Log\AccessLogFormatterInterface as LegacyAccessLogFormatterInterface; |
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.
This is removed, as we conflict with the zend-expressive-swoole package now, so the two cannot be installed in parallel.
* @var EventDispatcherInterface|MockObject | ||
* @psalm-var EventDispatcherInterface&MockObject | ||
*/ | ||
/** @var EventDispatcherInterface&MockObject */ |
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.
phpcs no longer barfs on intersection types, so we can combine the annotations.
@@ -63,17 +53,20 @@ public function setUp(): void | |||
|
|||
public function testConstructorRaisesExceptionWhenMasterPidIsNotZero(): void | |||
{ | |||
/** @var SwooleHttpServer&MockObject $httpServer */ |
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.
Adding this resolves IDE completion
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.
Phpstorm already has autocomplete for this 🤔
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.
intelephense does not. 😄
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.
Beware:
- phpcs rules (especially
slevomat/*
) tent to replace/** @var T&V $value */
withassert($value instanceof T && $value instanceof V)
assert($value instanceof T && $value instanceof V)
is considered redundant byvimeo/psalm
Not a problem for now, but these hints will be removed in some non-far future, where inference can be obtained by psalm ;-)
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.
LGTM, but I'll be honest, I'm not the right person for the docs section :|
This patch updates to the laminas/laminas-httphandlerrunner v2 series, which introduces a BC break.
To accomplish this, I have:
^1.1
to^2.1
.SwooleRequestHandlerRunner
to implementLaminas\HttpHandlerRunner\RequestHandlerRunnerInterface
, no longer extendLaminas\HttpHandlerRunner\RequestHandlerRunner
(because it is marked final), and mark itself final.This is a BC break because:
SwooleRequestHandlerRunner
has changed; hinting on its parent type no longer works the same.SwooleRequestHandlerRunner
.Fixes #78