CodeIgniter Forums
getStatusCode Deprecation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: getStatusCode Deprecation (/showthread.php?tid=79154)



getStatusCode Deprecation - Derek - 04-29-2021

In CodeIgniter\HTTP\ResponseInterface the getStatusCode function is deprecated and says, "To be replaced by the PSR-7 version (compatible)". I am curious as to why this was deprecated since it is part of the ResponseInterface in the PSR 7 spec found at https://www.php-fig.org/psr/psr-7/. If this should be deprecated, what should we be using as an alternative function to get the status code?


RE: getStatusCode Deprecation - MGatner - 05-02-2021

The problem is that the framework’s signature includes the return type (“: int”) which makes it incompatible with the PSR interface. The method will remain and will continue to work but we needed developers to realize that the method signature will change.
That said FIG has been releasing updated interfaces for PHP 8 with complete method signatures, and since these deprecations would not go into full effect until CodeIgniter 5 I don’t know what that means for the future of our HTTP layer.


RE: getStatusCode Deprecation - Derek - 05-04-2021

OK, thanks for letting me know. I won't worry about replacing it then.