Skip to content

Commit 7db0e49

Browse files
staabmsebastianbergmann
authored andcommitted
Use is_file over file_exists
`is_file` is faster
1 parent 79099b4 commit 7db0e49

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Runner/Baseline/Reader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use const DIRECTORY_SEPARATOR;
1313
use function assert;
1414
use function dirname;
15-
use function file_exists;
15+
use function is_file;
1616
use function realpath;
1717
use function sprintf;
1818
use function str_replace;
@@ -36,7 +36,7 @@ final class Reader
3636
*/
3737
public function read(string $baselineFile): Baseline
3838
{
39-
if (!file_exists($baselineFile)) {
39+
if (!is_file($baselineFile)) {
4040
throw new CannotLoadBaselineException(
4141
sprintf(
4242
'Cannot read baseline %s, file does not exist',

src/Util/PHP/AbstractPhpProcess.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use function array_merge;
1616
use function assert;
1717
use function explode;
18-
use function file_exists;
1918
use function file_get_contents;
2019
use function ini_get_all;
20+
use function is_file;
2121
use function restore_error_handler;
2222
use function set_error_handler;
2323
use function trim;
@@ -140,7 +140,7 @@ public function runTestJob(string $job, Test $test, string $processResultFile):
140140

141141
$processResult = '';
142142

143-
if (file_exists($processResultFile)) {
143+
if (is_file($processResultFile)) {
144144
$processResult = file_get_contents($processResultFile);
145145

146146
@unlink($processResultFile);

0 commit comments

Comments
 (0)