- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8
Middleware attribute #93
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
base: master
Are you sure you want to change the base?
Conversation
| PR Summary
 | 
| Codecov ReportAll 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 Sentry. | 
| Interesting approach. | 
# Conflicts: # src/MiddlewareFactory.php
| private ContainerInterface $container, | ||
| private ?ParametersResolverInterface $parametersResolver = null | 
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.
Why drop "readonly"?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no reasons to make MiddlewareFactory internal
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.
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: