1
0
Fork 0

PHPStan fixes

pull/8566/head
Jordi Boggiano 2020-02-07 23:10:10 +01:00
parent fbba175874
commit 589abb06a3
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 11 additions and 5 deletions

View File

@ -17,9 +17,15 @@ parameters:
# variable defined in eval # variable defined in eval
- '~^Undefined variable: \$res$~' - '~^Undefined variable: \$res$~'
# erroneous detection of missing const, see https://github.com/phpstan/phpstan/issues/2960
- '~^Access to undefined constant ZipArchive::OPSYS_UNIX.$~'
# we don't have different constructors for parent/child # we don't have different constructors for parent/child
- '~^Unsafe usage of new static\(\)\.$~' - '~^Unsafe usage of new static\(\)\.$~'
# BC with older PHPUnit
- '~^Call to an undefined static method PHPUnit\\Framework\\TestCase::setExpectedException\(\)\.$~'
# hhvm should have support for $this in closures # hhvm should have support for $this in closures
- -
count: 1 count: 1

View File

@ -68,7 +68,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
return $this->doDownload($package, $path, $url, $prevPackage); return $this->doDownload($package, $path, $url, $prevPackage);
} catch (\Exception $e) { } catch (\Exception $e) {
// rethrow phpunit exceptions to avoid hard to debug bug failures // rethrow phpunit exceptions to avoid hard to debug bug failures
if ($e instanceof \PHPUnit_Framework_Exception) { if ($e instanceof \PHPUnit\Framework\Exception) {
throw $e; throw $e;
} }
if ($this->io->isDebug()) { if ($this->io->isDebug()) {
@ -126,7 +126,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
break; break;
} catch (\Exception $e) { } catch (\Exception $e) {
// rethrow phpunit exceptions to avoid hard to debug bug failures // rethrow phpunit exceptions to avoid hard to debug bug failures
if ($e instanceof \PHPUnit_Framework_Exception) { if ($e instanceof \PHPUnit\Framework\Exception) {
throw $e; throw $e;
} }
if ($this->io->isDebug()) { if ($this->io->isDebug()) {
@ -179,7 +179,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
break; break;
} catch (\Exception $exception) { } catch (\Exception $exception) {
// rethrow phpunit exceptions to avoid hard to debug bug failures // rethrow phpunit exceptions to avoid hard to debug bug failures
if ($exception instanceof \PHPUnit_Framework_Exception) { if ($exception instanceof \PHPUnit\Framework\Exception) {
throw $exception; throw $exception;
} }
if ($this->io->isDebug()) { if ($this->io->isDebug()) {

View File

@ -24,7 +24,7 @@ class HtmlOutputFormatterTest extends TestCase
'warning' => new OutputFormatterStyle('black', 'yellow'), 'warning' => new OutputFormatterStyle('black', 'yellow'),
)); ));
return $this->assertEquals( $this->assertEquals(
'text <span style="color:green;">green</span> <span style="color:yellow;">yellow</span> <span style="color:black;background-color:yellow;">black w/ yello bg</span>', 'text <span style="color:green;">green</span> <span style="color:yellow;">yellow</span> <span style="color:black;background-color:yellow;">black w/ yello bg</span>',
$formatter->format('text <info>green</info> <comment>yellow</comment> <warning>black w/ yello bg</warning>') $formatter->format('text <info>green</info> <comment>yellow</comment> <warning>black w/ yello bg</warning>')
); );

View File

@ -53,7 +53,7 @@ class PackageDependencyParserTest extends TestCase
{ {
$data = json_decode(file_get_contents(__DIR__.'/Fixtures/DependencyParserTestData.json'), true); $data = json_decode(file_get_contents(__DIR__.'/Fixtures/DependencyParserTestData.json'), true);
if (0 !== json_last_error()) { if (0 !== json_last_error()) {
throw new \PHPUnit_Framework_Exception('Invalid json file.'); throw new \PHPUnit\Framework\Exception('Invalid json file.');
} }
return $data; return $data;