slimphp / Slim-Psr7

PSR-7 implementation for use with Slim 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reuse base class code

mapogolions opened this issue · comments

The abstract class Message, among others, defines two protected properties - $headers & $body. Any derived class will be inherit them. In paticular, two classes Request & Response. But classes define constructor parameters differently.

  • Request::__construct(..., HeadersInterface $headers, StreamInterface $body)
  • Response::__construct(..., ?HeadersInterface $headers, ?StreamInterface $body)
    If the base class (Message) defines the constructor, what would be the default behavior ?
    ?HeadersInterface or HeadersInterface & ?StreamInterface or StreamInterface.

I think we should make it optional for both ::__construct(..., ?HeadersInterface $headers, ?StreamInterface $body)