mirror of
https://github.com/composer/composer
synced 2025-05-09 08:32:56 +00:00
Fix CS (#11003)
This commit is contained in:
parent
6e205a0c84
commit
131da999ac
357 changed files with 5943 additions and 9174 deletions
|
@ -38,9 +38,8 @@ class FileDownloaderTest extends TestCase
|
|||
* @param \Composer\Cache $cache
|
||||
* @param \Composer\Util\HttpDownloader&\PHPUnit\Framework\MockObject\MockObject $httpDownloader
|
||||
* @param \Composer\Util\Filesystem $filesystem
|
||||
* @return \Composer\Downloader\FileDownloader
|
||||
*/
|
||||
protected function getDownloader(\Composer\IO\IOInterface $io = null, ?Config $config = null, EventDispatcher $eventDispatcher = null, \Composer\Cache $cache = null, $httpDownloader = null, Filesystem $filesystem = null): FileDownloader
|
||||
protected function getDownloader(?\Composer\IO\IOInterface $io = null, ?Config $config = null, ?EventDispatcher $eventDispatcher = null, ?\Composer\Cache $cache = null, $httpDownloader = null, ?Filesystem $filesystem = null): FileDownloader
|
||||
{
|
||||
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
$config = $config ?: $this->getConfig();
|
||||
|
@ -48,7 +47,7 @@ class FileDownloaderTest extends TestCase
|
|||
$httpDownloader
|
||||
->expects($this->any())
|
||||
->method('addCopy')
|
||||
->will($this->returnValue(\React\Promise\resolve(new Response(array('url' => 'http://example.org/'), 200, array(), 'file~'))));
|
||||
->will($this->returnValue(\React\Promise\resolve(new Response(['url' => 'http://example.org/'], 200, [], 'file~'))));
|
||||
$this->httpDownloader = $httpDownloader;
|
||||
|
||||
return new FileDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $filesystem);
|
||||
|
@ -109,7 +108,7 @@ class FileDownloaderTest extends TestCase
|
|||
$ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
$ioMock->expects($this->any())
|
||||
->method('write')
|
||||
->will($this->returnCallback(function ($messages, $newline = true) use ($path) {
|
||||
->will($this->returnCallback(static function ($messages, $newline = true) use ($path) {
|
||||
if (is_file($path.'/script.js')) {
|
||||
unlink($path.'/script.js');
|
||||
}
|
||||
|
@ -124,7 +123,7 @@ class FileDownloaderTest extends TestCase
|
|||
try {
|
||||
$loop = new Loop($this->httpDownloader);
|
||||
$promise = $downloader->download($package, $path);
|
||||
$loop->wait(array($promise));
|
||||
$loop->wait([$promise]);
|
||||
|
||||
$this->fail('Download was expected to throw');
|
||||
} catch (\Exception $e) {
|
||||
|
@ -166,7 +165,7 @@ class FileDownloaderTest extends TestCase
|
|||
$this->getMockBuilder('Composer\IO\IOInterface')->getMock(),
|
||||
$this->getProcessExecutorMock()
|
||||
);
|
||||
$dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, function (PreFileDownloadEvent $event) use ($expectedUrl): void {
|
||||
$dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, static function (PreFileDownloadEvent $event) use ($expectedUrl): void {
|
||||
$event->setProcessedUrl($expectedUrl);
|
||||
});
|
||||
|
||||
|
@ -198,7 +197,7 @@ class FileDownloaderTest extends TestCase
|
|||
$this->assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
|
||||
|
||||
return \React\Promise\resolve(
|
||||
new Response(array('url' => 'http://example.org/'), 200, array(), 'file~')
|
||||
new Response(['url' => 'http://example.org/'], 200, [], 'file~')
|
||||
);
|
||||
}));
|
||||
|
||||
|
@ -207,7 +206,7 @@ class FileDownloaderTest extends TestCase
|
|||
try {
|
||||
$loop = new Loop($this->httpDownloader);
|
||||
$promise = $downloader->download($package, $path);
|
||||
$loop->wait(array($promise));
|
||||
$loop->wait([$promise]);
|
||||
|
||||
$this->fail('Download was expected to throw');
|
||||
} catch (\Exception $e) {
|
||||
|
@ -250,7 +249,7 @@ class FileDownloaderTest extends TestCase
|
|||
$this->getMockBuilder('Composer\IO\IOInterface')->getMock(),
|
||||
$this->getProcessExecutorMock()
|
||||
);
|
||||
$dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, function (PreFileDownloadEvent $event) use ($customCacheKey): void {
|
||||
$dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, static function (PreFileDownloadEvent $event) use ($customCacheKey): void {
|
||||
$event->setCustomCacheKey($customCacheKey);
|
||||
});
|
||||
|
||||
|
@ -282,7 +281,7 @@ class FileDownloaderTest extends TestCase
|
|||
$this->assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
|
||||
|
||||
return \React\Promise\resolve(
|
||||
new Response(array('url' => 'http://example.org/'), 200, array(), 'file~')
|
||||
new Response(['url' => 'http://example.org/'], 200, [], 'file~')
|
||||
);
|
||||
}));
|
||||
|
||||
|
@ -291,7 +290,7 @@ class FileDownloaderTest extends TestCase
|
|||
try {
|
||||
$loop = new Loop($this->httpDownloader);
|
||||
$promise = $downloader->download($package, $path);
|
||||
$loop->wait(array($promise));
|
||||
$loop->wait([$promise]);
|
||||
|
||||
$this->fail('Download was expected to throw');
|
||||
} catch (\Exception $e) {
|
||||
|
@ -354,7 +353,7 @@ class FileDownloaderTest extends TestCase
|
|||
try {
|
||||
$loop = new Loop($this->httpDownloader);
|
||||
$promise = $downloader->download($package, $path);
|
||||
$loop->wait(array($promise));
|
||||
$loop->wait([$promise]);
|
||||
|
||||
$this->fail('Download was expected to throw');
|
||||
} catch (\Exception $e) {
|
||||
|
@ -403,7 +402,7 @@ class FileDownloaderTest extends TestCase
|
|||
|
||||
$loop = new Loop($this->httpDownloader);
|
||||
$promise = $downloader->download($newPackage, $path, $oldPackage);
|
||||
$loop->wait(array($promise));
|
||||
$loop->wait([$promise]);
|
||||
|
||||
$downloader->update($oldPackage, $newPackage, $path);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue