1
0
Fork 0

Fix some PHPStan errors/..

pull/10343/head
Jordi Boggiano 2021-12-09 13:02:20 +01:00
parent 59603a357a
commit 095c36ecf8
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
5 changed files with 18 additions and 17 deletions

View File

@ -58,7 +58,7 @@ jobs:
- php-version: "8.2"
dependencies: highest-ignore
os: ubuntu-latest
experimental: false
experimental: true
steps:
- name: "Checkout"

View File

@ -23,6 +23,7 @@ jobs:
php-version:
- "7.2"
- "8.1"
fail-fast: false
steps:
- name: "Checkout"

View File

@ -174,10 +174,10 @@ class Compiler
}
if ($extraFiles) {
throw new \RuntimeException('These files were expected but not added to the phar, they might be excluded or gone from the source package:'.PHP_EOL.implode(PHP_EOL, $extraFiles));
throw new \RuntimeException('These files were expected but not added to the phar, they might be excluded or gone from the source package:'.PHP_EOL.var_export($extraFiles, true));
}
if ($unexpectedFiles) {
throw new \RuntimeException('These files were unexpectedly added to the phar, make sure they are excluded or listed in $extraFiles:'.PHP_EOL.implode(PHP_EOL, $unexpectedFiles));
throw new \RuntimeException('These files were unexpectedly added to the phar, make sure they are excluded or listed in $extraFiles:'.PHP_EOL.var_export($unexpectedFiles, true));
}
// Add bin/composer

View File

@ -223,7 +223,7 @@ class InstallationManager
};
$handleInterruptsUnix = function_exists('pcntl_async_signals') && function_exists('pcntl_signal');
$handleInterruptsWindows = function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli';
$handleInterruptsWindows = PHP_VERSION_ID >= 70400 && function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli';
$prevHandler = null;
$windowsHandler = null;
if ($handleInterruptsUnix) {

View File

@ -114,7 +114,7 @@ class ZipDownloaderTest extends TestCase
$this->setPrivateProperty('hasZipArchive', true);
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
$zipArchive = $this->getMockBuilder('ZipArchive')->onlyMethods(['open', 'extractTo'])->getMock();
$zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
$zipArchive->expects($this->once())
->method('open')
->will($this->returnValue(true));
@ -137,10 +137,10 @@ class ZipDownloaderTest extends TestCase
$this->setPrivateProperty('hasZipArchive', true);
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
$zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
$zipArchive->expects($this->at(0))
$zipArchive->expects($this->once())
->method('open')
->will($this->returnValue(true));
$zipArchive->expects($this->at(1))
$zipArchive->expects($this->once())
->method('extractTo')
->will($this->throwException(new \ErrorException('Not a directory')));
@ -158,10 +158,10 @@ class ZipDownloaderTest extends TestCase
$this->setPrivateProperty('hasZipArchive', true);
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
$zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
$zipArchive->expects($this->at(0))
$zipArchive->expects($this->once())
->method('open')
->will($this->returnValue(true));
$zipArchive->expects($this->at(1))
$zipArchive->expects($this->once())
->method('extractTo')
->will($this->returnValue(true));
@ -189,7 +189,7 @@ class ZipDownloaderTest extends TestCase
->will($this->returnValue('output'));
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
$processExecutor->expects($this->at(0))
$processExecutor->expects($this->once())
->method('executeAsync')
->will($this->returnValue(\React\Promise\resolve($procMock)));
@ -216,7 +216,7 @@ class ZipDownloaderTest extends TestCase
->will($this->returnValue('output'));
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
$processExecutor->expects($this->at(0))
$processExecutor->expects($this->once())
->method('executeAsync')
->will($this->returnValue(\React\Promise\resolve($procMock)));
@ -246,15 +246,15 @@ class ZipDownloaderTest extends TestCase
->will($this->returnValue('output'));
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
$processExecutor->expects($this->at(0))
$processExecutor->expects($this->once())
->method('executeAsync')
->will($this->returnValue(\React\Promise\resolve($procMock)));
$zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
$zipArchive->expects($this->at(0))
$zipArchive->expects($this->once())
->method('open')
->will($this->returnValue(true));
$zipArchive->expects($this->at(1))
$zipArchive->expects($this->once())
->method('extractTo')
->will($this->returnValue(true));
@ -286,15 +286,15 @@ class ZipDownloaderTest extends TestCase
->will($this->returnValue('output'));
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
$processExecutor->expects($this->at(0))
$processExecutor->expects($this->once())
->method('executeAsync')
->will($this->returnValue(\React\Promise\resolve($procMock)));
$zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
$zipArchive->expects($this->at(0))
$zipArchive->expects($this->once())
->method('open')
->will($this->returnValue(true));
$zipArchive->expects($this->at(1))
$zipArchive->expects($this->once())
->method('extractTo')
->will($this->returnValue(false));