Skip to content

Commit

Permalink
Merge branch '1.10' into 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Sep 26, 2015
2 parents 5db7528 + 503f807 commit 6319fe6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Symfony/CS/Fixer/Symfony/BlanklineAfterOpenTagFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function fix(\SplFileInfo $file, $content)
}

$newlineFound = false;
/** @var Token $token */
foreach ($tokens as $token) {
if ($token->isWhitespace(array('whitespaces' => "\n"))) {
$newlineFound = true;
Expand All @@ -56,7 +57,7 @@ public function fix(\SplFileInfo $file, $content)
$token->setContent(rtrim($token->getContent())."\n");
}

if (!$tokens[1]->isWhitespace(array('whitespaces' => "\n"))) {
if (!$tokens[1]->isWhitespace() && false === strpos($tokens[1]->getContent(), "\n")) {
$tokens->insertAt(1, new Token(array(T_WHITESPACE, "\n")));
}

Expand Down
10 changes: 10 additions & 0 deletions Symfony/CS/Tests/Fixer/Symfony/BlanklineAfterOpenTagFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public function testFix54($expected, $input = null)
public function provideCases()
{
return array(
array(
'<?php
class SomeClass
{
const VERSION = "1.1.1";
const FOO = "bar";
}
',
),
array(
'<?php $foo = true; ?>',
),
Expand Down

0 comments on commit 6319fe6

Please sign in to comment.