Skip to content

Commit e6285fd

Browse files
committed
Merge branch '2.14'
* 2.14: Use lowercase mikey179/vfsStream in composer.json Fixed TypeShortNameResolverTest::testResolver Unset the auxillary variable $a Fix output escaping of diff for text format when line is not changed
2 parents b7a20c7 + a06dacb commit e6285fd

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0",
3636
"justinrainbow/json-schema": "^5.0",
3737
"keradus/cli-executor": "^1.2",
38-
"mikey179/vfsStream": "^1.6",
38+
"mikey179/vfsstream": "^1.6",
3939
"php-coveralls/php-coveralls": "^2.1",
4040
"php-cs-fixer/accessible-object": "^1.0",
4141
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1",

php-cs-fixer

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ if ($require) {
6060
} else {
6161
require_once __DIR__.'/vendor/autoload.php';
6262
}
63+
64+
unset($a);
6365
}
6466
unset($require);
6567

src/Differ/DiffConsoleFormatter.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ public function format($diff, $lineTemplate = '%s')
6262
implode(
6363
PHP_EOL,
6464
array_map(
65-
function ($string) use ($isDecorated, $lineTemplate) {
65+
static function ($line) use ($isDecorated, $lineTemplate) {
6666
if ($isDecorated) {
67-
$string = Preg::replaceCallback(
67+
$count = 0;
68+
$line = Preg::replaceCallback(
6869
[
6970
'/^(\+.*)/',
7071
'/^(\-.*)/',
@@ -81,11 +82,17 @@ function ($matches) {
8182

8283
return sprintf('<fg=%s>%s</fg=%s>', $colour, OutputFormatter::escape($matches[0]), $colour);
8384
},
84-
$string
85+
$line,
86+
1,
87+
$count
8588
);
89+
90+
if (0 === $count) {
91+
$line = OutputFormatter::escape($line);
92+
}
8693
}
8794

88-
return sprintf($lineTemplate, $string);
95+
return sprintf($lineTemplate, $line);
8996
},
9097
Preg::split('#\R#u', $diff)
9198
)

tests/Fixtures/FixCommand/TextDiffTestInput.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ final class TextDiffTestInput
2222
public function foo($output)
2323
{
2424
$output->writeln('<error>'.(int)$output.'</error>');
25+
$output->writeln('<error> TEST </error>');
26+
$output->writeln('<error>'.(int)$output.'</error>');
2527
}
2628
}

tests/TextDiffTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public function provideDiffReportingCases()
7070
$expected = <<<'TEST'
7171
%A$output->writeln('<error>'.(int)$output.'</error>');%A
7272
%A$output->writeln('<error>'.(int) $output.'</error>');%A
73+
%A$output->writeln('<error> TEST </error>');%A
74+
%A$output->writeln('<error>'.(int)$output.'</error>');%A
75+
%A$output->writeln('<error>'.(int) $output.'</error>');%A
7376
TEST;
7477
$cases = [];
7578
foreach (['txt', 'xml', 'junit'] as $format) {

tests/Tokenizer/Resolver/TypeShortNameResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public function provideResolverCases()
4242
{
4343
return [
4444
[
45-
'<?php',
45+
'<?php ',
4646
'SomeType',
4747
'SomeType',
4848
],
4949
[
50-
'<?php',
50+
'<?php ',
5151
'string',
5252
'string',
5353
],

0 commit comments

Comments
 (0)