Skip to content

Commit

Permalink
PHP 8.1 support (#134)
Browse files Browse the repository at this point in the history
* PHP 8.1 support

Still a WIP until closer to the release date

* Minor fixes

* Fix typo

* More updates

* Use a test which works in both old and new phpunit versions without
warning
  • Loading branch information
exussum12 authored Feb 23, 2022
1 parent e54e9a2 commit 25007c3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/Command/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ private function createOption(InputInterface $input): Option
private function getCSVOption(InputInterface $input, string $option): array
{
$result = $input->getOption($option);

if (null === $result) {
return [];
}

if (false === is_array($result)) {
return array_filter(
explode(',', (string) $result),
Expand All @@ -244,9 +249,6 @@ static function ($value) {
);
}

if (null === $result) {
return [];
}

return $result;
}
Expand Down
10 changes: 9 additions & 1 deletion tests/Command/RunCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ public function testItDoesNotFailCommandWhenFileOnPathDoesNotExist(): void
]);

$this->assertSame(RunCommand::SUCCESS, $this->commandTester->getStatusCode());
$this->assertRegExp('/No files found to scan/i', $this->commandTester->getDisplay());
$output = $this->commandTester->getDisplay();

/* This should use assertStringContainsString but the lowest phpunit supported does not allow that */
$found = false;
if (strpos($output, 'No files found to scan') !== false) {
$found = true;
}

$this->assertTrue($found);
}
}
1 change: 0 additions & 1 deletion tests/Printer/XmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class XmlTest extends TestCase
public function testEmpty() : void
{
$outputPath = tempnam(sys_get_temp_dir(), 'phpmnd_');

$xmlPrinter = new Xml($outputPath);
$xmlPrinter->printData(new NullOutput(), new HintList(), []);

Expand Down

0 comments on commit 25007c3

Please sign in to comment.