1
0
Fork 0

Make use of new PHP 8.4.0 function to replace implicit $http_response_header var (#11995)

pull/12063/head
Jordi Boggiano 2024-07-25 17:43:11 +02:00 committed by GitHub
parent 39981a0e2b
commit 17f4984601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 8 deletions

View File

@ -2045,11 +2045,6 @@ parameters:
count: 1
path: ../src/Composer/Installer.php
-
message: "#^Casting to bool something that's already bool\\.$#"
count: 1
path: ../src/Composer/Installer.php
-
message: "#^Only booleans are allowed in &&, array\\<array\\<string, string\\>\\> given on the right side\\.$#"
count: 1
@ -4353,6 +4348,16 @@ parameters:
count: 8
path: ../src/Composer/Util/RemoteFilesystem.php
-
message: "#^Function http_clear_last_response_headers not found\\.$#"
count: 1
path: ../src/Composer/Util/RemoteFilesystem.php
-
message: "#^Function http_get_last_response_headers not found\\.$#"
count: 1
path: ../src/Composer/Util/RemoteFilesystem.php
-
message: "#^Method Composer\\\\Util\\\\RemoteFilesystem\\:\\:copy\\(\\) should return bool but returns bool\\|string\\.$#"
count: 1
@ -5095,4 +5100,3 @@ parameters:
message: "#^Only booleans are allowed in a ternary operator condition, array\\<string\\> given\\.$#"
count: 1
path: ../tests/Composer/Test/Util/TlsHelperTest.php

View File

@ -1329,7 +1329,7 @@ class Installer
*/
public function setRunScripts(bool $runScripts = true): self
{
$this->runScripts = (bool) $runScripts;
$this->runScripts = $runScripts;
return $this;
}

View File

@ -533,7 +533,12 @@ class RemoteFilesystem
}
// https://www.php.net/manual/en/reserved.variables.httpresponseheader.php
$responseHeaders = $http_response_header ?? [];
if (PHP_VERSION_ID >= 80400) {
$responseHeaders = http_get_last_response_headers();
http_clear_last_response_headers();
} else {
$responseHeaders = $http_response_header ?? [];
}
if (null !== $e) {
throw $e;