Skip to content

Commit 4e9ab39

Browse files
Fix
1 parent d661f7b commit 4e9ab39

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

bin/gendiff

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (file_exists($autoloadPathLocal)) {
1111
require_once $autoloadPathGlobal;
1212
}
1313

14-
use function Differ\Parser\Parse;
14+
use function Differ\Parser\parseDiff;
1515

1616
$doc = <<<DOC
1717
Generate diff
@@ -29,4 +29,4 @@ DOC;
2929

3030
$args = Docopt::handle($doc, array('version' => 'Gendiff 1.0'));
3131

32-
parse($args['<firstFile>'], $args['<secondFile>'], $args['--format']);
32+
parseDiff($args['<firstFile>'], $args['<secondFile>'], $args['--format']);

src/Differ/Translator.php

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Differ\Translator;
44

55
use Symfony\Component\Yaml\Yaml;
6+
67
use function Differ\Parser\parseError;
78

89
function getJson(string $path): array

src/Parser.php

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@
22

33
namespace Differ\Parser;
44

5-
use JetBrains\PhpStorm\NoReturn;
65
use function cli\line;
76
use function Differ\Differ\genDiff;
87

9-
function parse(string $pathToFile1, string $pathToFile2, string $format): void
8+
function parse(string $string): void
9+
{
10+
line('%s', $string);
11+
exit();
12+
}
13+
14+
function parseDiff(string $pathToFile1, string $pathToFile2, string $format): void
1015
{
1116
$resultString = genDiff($pathToFile1, $pathToFile2, $format);
12-
line('%s', $resultString);
17+
parse($resultString);
1318
}
1419

15-
#[NoReturn] function parseError(string $errorMessage): void
20+
function parseError(string $errorMessage): void
1621
{
17-
line('%s', $errorMessage);
18-
exit();
22+
parse($errorMessage);
1923
}

0 commit comments

Comments
 (0)