Skip to content

Commit

Permalink
Fix CS/WS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 22, 2024
1 parent 3b58e65 commit e1846c8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Runner/PhptTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ private function cleanupForCoverage(): RawCodeCoverageData
$files = $this->getCoverageFiles();

$buffer = false;

if (is_file($files['coverage'])) {
$buffer = @file_get_contents($files['coverage']);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Runner/ResultCache/DefaultResultCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use function file_put_contents;
use function is_array;
use function is_dir;
use function is_file;
use function json_decode;
use function json_encode;
use PHPUnit\Framework\TestStatus\TestStatus;
Expand Down Expand Up @@ -88,6 +89,7 @@ public function load(): void
if (!is_file($this->cacheFilename)) {
return;
}

$contents = file_get_contents($this->cacheFilename);

if ($contents === false) {
Expand Down
1 change: 1 addition & 0 deletions src/TextUI/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace PHPUnit\TextUI;

use const PHP_EOL;
use function is_file;
use function is_readable;
use function printf;
use function realpath;
Expand Down
2 changes: 2 additions & 0 deletions src/Util/PHP/AbstractPhpProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use function array_merge;
use function assert;
use function escapeshellarg;
use function file_exists;
use function file_get_contents;
use function ini_get_all;
use function restore_error_handler;
Expand Down Expand Up @@ -142,6 +143,7 @@ public function runTestJob(string $job, Test $test, string $processResultFile):

if (file_exists($processResultFile)) {
$processResult = file_get_contents($processResultFile);

@unlink($processResultFile);
}

Expand Down
18 changes: 12 additions & 6 deletions tests/end-to-end/regression/5764/error-handler.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<?php

// be forgiving with error handlers which do not suppress `@` prefixed lines
set_error_handler(function(int $err_lvl, string $err_msg, string $err_file, int $err_line): bool {
throw new \ErrorException($err_msg, 0, $err_lvl, $err_file, $err_line);
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
\set_error_handler(static function (int $err_lvl, string $err_msg, string $err_file, int $err_line): bool
{
throw new ErrorException($err_msg, 0, $err_lvl, $err_file, $err_line);
});

1 change: 0 additions & 1 deletion tests/end-to-end/regression/5764/tests/Issue5764Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
namespace PHPUnit\TestFixture\Issue5764;

use Exception;
use PHPUnit\Framework\TestCase;

final class Issue5764Test extends TestCase
Expand Down

0 comments on commit e1846c8

Please sign in to comment.