Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Rector\Tests\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector\Fixture;

class CommaInArray
{
public function run()
{
$variable = [
<<<EOT
<?php
/** @readonly */
class C {
}\n
EOT,
new \stdClass()
];
}
}

?>
-----
<?php

namespace Rector\Tests\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector\Fixture;

class CommaInArray
{
public function run()
{
$variable = [
<<<EOT
<?php
/** @readonly */
class C {
}

EOT
,
new \stdClass()
];
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ class Fixture
SELECT *
FROM `table`
WHERE `column` = true;
SQL;
SQL
;
$this->setOnClick(<<<SQL
SELECT *
FROM `table`
WHERE `column` = true;
SQL);
SQL
);
$this->setOnClick(<<<JAVASCRIPT
document.getElementById('{$this->getHtmlId()}').value = '';
document.getElementById('{$this->getHtmlId()}').onchange();
JAVASCRIPT);
JAVASCRIPT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ EOS

$needsDowngrade1 = sprintf(<<<EOS
test %s
EOS, 'more');
EOS
, 'more');

$needsDowngrade2 = <<<EOS
test
EOS; $z = '';
EOS
; $z = '';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public function refactor(Node $node): ?Node
$node->setAttribute(AttributeKey::DOC_INDENTATION, '__REMOVED__');
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);

$tokens = $this->file->getOldTokens();
if (isset($tokens[$node->getEndTokenPos()], $tokens[$node->getEndTokenPos() + 1])) {
$tokens[$node->getEndTokenPos() + 1]->text = "\n" . $tokens[$node->getEndTokenPos() + 1]->text;
}

return $node;
}
}
Loading