Middleware attribute - #93
Conversation
PR Summary
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #93 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 109 116 +7
===========================================
Files 8 9 +1
Lines 291 300 +9
===========================================
+ Hits 291 300 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Interesting approach. |
# Conflicts: # src/MiddlewareFactory.php
| private ContainerInterface $container, | ||
| private ?ParametersResolverInterface $parametersResolver = null |
There was a problem hiding this comment.
It was written before the rector changes
| private MiddlewareFactory $middlewareFactory, | ||
| private ?EventDispatcherInterface $eventDispatcher = null | ||
| ) { | ||
| if ($eventDispatcher !== null && !$middlewareFactory->hasEventDispatcher()) { |
There was a problem hiding this comment.
Suggest major refactoring...
1) Mark MiddlewareFactory as internal
2) Create MiddlewareFactory in constructor and replace private MiddlewareFactory $middlewareFactory, to:
private ContainerInterface $container,
private ?ParametersResolverInterface $parametersResolver = null
- Pass currently instance of dispatcher to
MiddlewareFactoryconstructor.
It's allow use MiddlewareDispatcher::withMiddlewares() into MiddlewareFactory.
There was a problem hiding this comment.
There are no reasons to make MiddlewareFactory internal
There was a problem hiding this comment.
Agree with internal. But 2 and 3 is actual. MiddlewareFactory methods withEventDispatcher() and hasEventDispatcher() looks strange.
It allows users to use middlewares like the following: