Fix some PHPStan errors/..

main
Jordi Boggiano 2 years ago
parent 59603a357a
commit 095c36ecf8
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

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

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

@ -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

@ -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) {

@ -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));

Loading…
Cancel
Save