Deprecated multiple behavior methods#158
Deprecated multiple behavior methods#158thomasvargiu wants to merge 2 commits intozendframework:masterfrom
Conversation
|
@thomasvargiu I see the following problems:
And where is the plan or the pull requests to update components like zend-mvc? |
|
@froschdesign I was working on #157. In order to improve the code in a major release is useless to call $request->getHeader('name');when you can access the entire collection and get it with: $request->getHeaders()->get('name');IMHO, having a different behavior and a different return values based on arguments is not a good code. Of course we can improve deprecation messages. It is a deprecation, but we can remove that behavior only in major release. |
|
@thomasvargiu The question also remains:
|
|
Changes are easy because the same behavior exists in
|
zend-mvc v4 will be more likely to use PSR-7 (see thezend-mvc roadmap document — if we even decide to work towards a v4 at this point), which leaves the future of zend-http pretty much in maintenance mode. I do not see any reason at this point to do deprecations when we are unlikely to release a new major version ever. As such, I'm going to close this. |
In order to improve code quality and easily add type hints in a future release, I started to deprecate some methods with multiple behavior and different return types based on arguments.
Zend\Http\Request::getHeader()is deprecatedZend\Http\Request::getHeaders()with arguments is deprecatedZend\Http\Request::getQuery()with arguments is deprecatedZend\Http\Request::getPost()with arguments is deprecatedZend\Http\Request::getFiles()with arguments is deprecatedThe deprecation is for methods used as a "proxy".
Clients can access to them getting the collection first.
This will allow to introduce type hints for these methods in the future , something like: