Skip to content
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

Create Mezzio\ApplicationPipeline implementation for better static code analysis #105

Open
boesing opened this issue Jan 31, 2022 · 1 comment
Labels
Won't Fix This will not be worked on

Comments

@boesing
Copy link
Member

boesing commented Jan 31, 2022

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

In this package, Mezzio\ApplicationPipeline is a service identifier to retrieve the assembled middleware pipeline for a mezzio project which does not actually represents a class.

This pipeline is consumed by these classes in a mezzio project:

That pipeline gets assembled in:

return new MiddlewarePipe();

And registered in:

ApplicationPipeline::class => Container\ApplicationPipelineFactory::class,


Retrieving this pipeline via a PSR-11 is quite annoying due to the fact that neither an IDE is able to auto-complete the typed service name nor a static-analysis tool is able to understand what is happening.

My suggestion would be to create a class called ApplicationPipeline which implements MiddlewarePipeInterface (which implements both RequestHandlerInterface and MiddlewareInterface) and thus allow factories to retrieve that pipeline via:

  1. Mezzio\ApplicationPipeline class-string
  2. (optional) Psr\Http\Server\RequestHandlerInterface class-string (alias to Mezzio\ApplicationPipeline)

This would allow us to properly fetch the application pipeline from within the ApplicationFactory and the RequestHandlerRunnerFactory:

$container->get(ApplicationPipeline::class),

$container->get(ApplicationPipeline::class),

@boesing
Copy link
Member Author

boesing commented Jan 31, 2022

Created a PoC in #107

@boesing boesing added Won't Fix This will not be worked on and removed Enhancement New feature or request RFC labels Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Won't Fix This will not be worked on
Projects
None yet
1 participant