File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
src/JsonSchema/Uri/Retrievers Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,12 @@ public function retrieve($uri)
5151 }
5252
5353 $ this ->messageBody = $ response ;
54- if (function_exists ('http_get_last_response_headers ' )) {
55- // Use http_get_last_response_headers() for BC compatibility with PHP 8.5+
56- // where $http_response_header is deprecated.
57- $ http_response_header = http_get_last_response_headers ();
58- }
59- if (!empty ($ http_response_header )) {
60- // $http_response_header cannot be tested, because it's defined in the method's local scope
61- // See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info.
62- $ this ->fetchContentType ($ http_response_header ); // @codeCoverageIgnore
63- } else { // @codeCoverageIgnore
64- // Could be a "file://" url or something else - fake up the response
54+
55+ $ httpResponseHeaders = PHP_VERSION >= 80400 ? http_get_last_response_headers () : $ http_response_header ;
56+
57+ if (!empty ($ httpResponseHeaders )) {
58+ $ this ->fetchContentType ($ httpResponseHeaders );
59+ } else {
6560 $ this ->contentType = null ;
6661 }
6762
@@ -73,7 +68,7 @@ public function retrieve($uri)
7368 *
7469 * @return bool Whether the Content-Type header was found or not
7570 */
76- private function fetchContentType (array $ headers )
71+ private function fetchContentType (array $ headers ): bool
7772 {
7873 foreach (array_reverse ($ headers ) as $ header ) {
7974 if ($ this ->contentType = self ::getContentTypeMatchInHeader ($ header )) {
You can’t perform that action at this time.
0 commit comments