Skip to content

Commit 64d2f3b

Browse files
minor #874 Add some native return types (PhilETaylor)
This PR was merged into the 1.x branch. Discussion ---------- Add some native return types ### Symfony version(s) affected symfony/flex: v1.18.5 ### Description Composer version 2.3-dev (2.3-dev+c9baeda95b2da59a8c2d0bb7350b18d009aa891b) 2022-02-21 12:57:32 Symfony Project with `symfony/flex: v1.18.5` ``` PHP Fatal error: Declaration of Symfony\Flex\ParallelDownloader::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []) must be compatible with Composer\Util\RemoteFilesystem::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []): bool in /Users/phil/Sites/example.com/vendor/symfony/flex/src/ParallelDownloader.php on line 132 Fatal error: Declaration of Symfony\Flex\ParallelDownloader::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []) must be compatible with Composer\Util\RemoteFilesystem::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []): bool in /Users/phil/Sites/example.com/vendor/symfony/flex/src/ParallelDownloader.php on line 132 ``` ### How to reproduce ``` ~/Sites/symfony-test composer -V Composer version 2.3-dev (2.3-dev+c9baeda95b2da59a8c2d0bb7350b18d009aa891b) 2022-02-21 12:57:32 ~/Sites/symfony-test composer selfup --snapshot You are already using the latest available Composer version c9baeda95b2da59a8c2d0bb7350b18d009aa891b (snapshot channel). ~/Sites/symfony-test composer require symfony/flex 1.18.5 ./composer.json has been created Running composer update symfony/flex Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals - Locking symfony/flex (v1.18.5) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing symfony/flex (v1.18.5): Extracting archive symfony/flex contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "symfony/flex" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y PHP Fatal error: Declaration of Symfony\Flex\ParallelDownloader::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []) must be compatible with Composer\Util\RemoteFilesystem::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []): bool in /Users/phil/Sites/symfony-test/vendor/symfony/flex/src/ParallelDownloader.php on line 132 Fatal error: Declaration of Symfony\Flex\ParallelDownloader::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []) must be compatible with Composer\Util\RemoteFilesystem::copy($originUrl, $fileUrl, $fileName, $progress = true, $options = []): bool in /Users/phil/Sites/symfony-test/vendor/symfony/flex/src/ParallelDownloader.php on line 132 ~/Sites/symfony-test ``` ### Possible Solution `:bool` ? ### Additional Context I appreciate Im ahead of the game again running bleeding edge composer :) Commits ------- c3d8f5d Add some native return types
2 parents e2faf2b + c3d8f5d commit 64d2f3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ParallelDownloader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function download(array &$nextArgs, callable $nextCallback, bool $quiet =
103103
}
104104
}
105105

106-
public function getOptions()
106+
public function getOptions(): array
107107
{
108108
$options = array_replace_recursive(parent::getOptions(), $this->nextOptions);
109109
$this->nextOptions = [];
@@ -121,7 +121,7 @@ public function setNextOptions(array $options)
121121
/**
122122
* {@inheritdoc}
123123
*/
124-
public function getLastHeaders()
124+
public function getLastHeaders(): array
125125
{
126126
return $this->lastHeaders ?? parent::getLastHeaders();
127127
}
@@ -156,7 +156,7 @@ public function getContents($originUrl, $fileUrl, $progress = true, $options = [
156156
/**
157157
* @internal
158158
*/
159-
public function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax, $nativeDownload = true)
159+
public function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax, $nativeDownload = true): void
160160
{
161161
if (!$nativeDownload && \STREAM_NOTIFY_SEVERITY_ERR === $severity) {
162162
throw new TransportException($message, $messageCode);

0 commit comments

Comments
 (0)