Skip to content

Commit

Permalink
[automated] Apply Coding Standard (#3474)
Browse files Browse the repository at this point in the history
Co-authored-by: TomasVotruba <TomasVotruba@users.noreply.github.com>
  • Loading branch information
TomasVotruba and TomasVotruba committed Mar 12, 2023
1 parent 874f5e1 commit c077c9d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
48 changes: 24 additions & 24 deletions rules/CodingStyle/Application/UseImportsAdder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,6 @@ public function __construct(
) {
}

/**
* @param Stmt[] $stmts
* @param Use_[] $newUses
*/
private function mirrorUseComments(array $stmts, array $newUses, int $indexStmt = 0): void
{
if ($stmts === []) {
return;
}

if ($stmts[$indexStmt] instanceof Use_) {
$comments = (array) $stmts[$indexStmt]->getAttribute(AttributeKey::COMMENTS);

if ($comments !== []) {
$newUses[0]->setAttribute(
AttributeKey::COMMENTS,
$stmts[$indexStmt]->getAttribute(AttributeKey::COMMENTS)
);

$stmts[$indexStmt]->setAttribute(AttributeKey::COMMENTS, null);
}
}
}

/**
* @param Stmt[] $stmts
* @param array<FullyQualifiedObjectType|AliasedObjectType> $useImportTypes
Expand Down Expand Up @@ -129,6 +105,30 @@ public function addImportsToNamespace(
$namespace->stmts = array_merge($newUses, $namespace->stmts);
}

/**
* @param Stmt[] $stmts
* @param Use_[] $newUses
*/
private function mirrorUseComments(array $stmts, array $newUses, int $indexStmt = 0): void
{
if ($stmts === []) {
return;
}

if ($stmts[$indexStmt] instanceof Use_) {
$comments = (array) $stmts[$indexStmt]->getAttribute(AttributeKey::COMMENTS);

if ($comments !== []) {
$newUses[0]->setAttribute(
AttributeKey::COMMENTS,
$stmts[$indexStmt]->getAttribute(AttributeKey::COMMENTS)
);

$stmts[$indexStmt]->setAttribute(AttributeKey::COMMENTS, null);
}
}
}

/**
* @param array<FullyQualifiedObjectType|AliasedObjectType> $mainTypes
* @param array<FullyQualifiedObjectType|AliasedObjectType> $typesToRemove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,13 @@ function (Param $param) use ($originalParams): bool {
* @param Param[] $newParams
* @param Param[] $originalParams
*/
private function incrementParamIfExists(Param $param, string $newName, array $newParams, array $originalParams, int $count = 0): void
{
private function incrementParamIfExists(
Param $param,
string $newName,
array $newParams,
array $originalParams,
int $count = 0
): void {
$name = $newName;

if ($count > 0) {
Expand Down

0 comments on commit c077c9d

Please sign in to comment.