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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"doctrine/inflector": "^2.1",
"illuminate/container": "^11.46",
"nette/utils": "^4.0",
"nikic/php-parser": "^5.6.1",
"nikic/php-parser": "^5.6.2",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.3",
"phpstan/phpstan": "^2.1.26",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromo
final class DoNotRemoveParameterAttribute
{
public function __construct(
#[\SensitiveParameter]private string $password
#[\SensitiveParameter] private string $password
)
{
}
Expand Down
11 changes: 9 additions & 2 deletions rules/Php81/NodeManipulator/AttributeGroupNewLiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ public function newLine(File $file, Node $node): void
break;
}

if (trim($oldTokens[$startTokenPos + $iteration + 1]->text ?? '') === '') {
$space = ltrim($oldTokens[$startTokenPos + $iteration + 1]->text ?? '', "\r\n");
$nextTokenText = $oldTokens[$startTokenPos + $iteration + 1]->text ?? '';
if (trim($nextTokenText) === '') {
// when trimmed is empty string, but original text contains new line
// no need to add another new line
if (str_contains($nextTokenText, "\n") || str_contains($nextTokenText, "\r")) {
break;
}

$space = ltrim($nextTokenText, "\r\n");
} elseif (trim($oldTokens[$startTokenPos - 1]->text ?? '') === '') {
$space = ltrim($oldTokens[$startTokenPos - 1]->text ?? '', "\r\n");
} else {
Expand Down