Skip to content

Commit

Permalink
[automated] Apply Coding Standard (#5782)
Browse files Browse the repository at this point in the history
Co-authored-by: TomasVotruba <924196+TomasVotruba@users.noreply.github.com>
  • Loading branch information
TomasVotruba and TomasVotruba committed Mar 31, 2024
1 parent aa706a1 commit 93e0259
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/set/php82.php
Expand Up @@ -4,9 +4,9 @@

use Rector\Config\RectorConfig;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\Php82\Rector\Encapsed\VariableInStringInterpolationFixerRector;
use Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector;
use Rector\Php82\Rector\New_\FilesystemIteratorSkipDotsRector;
use Rector\Php82\Rector\Encapsed\VariableInStringInterpolationFixerRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rules([
Expand Down
Expand Up @@ -62,7 +62,7 @@ public function refactor(Node $node): ?Node

$startTokenPos = $part->getStartTokenPos();

if (! isset($oldTokens[$startTokenPos]) ) {
if (! isset($oldTokens[$startTokenPos])) {
continue;
}

Expand Down
22 changes: 13 additions & 9 deletions src/PhpParser/Printer/BetterStandardPrinter.php
Expand Up @@ -459,14 +459,6 @@ protected function pScalar_LNumber(LNumber $lNumber): string|int
return parent::pScalar_LNumber($lNumber);
}

private function resolveIndentSpaces(): string
{
$indentSize = SimpleParameterProvider::provideIntParameter(Option::INDENT_SIZE);

return str_repeat($this->getIndentCharacter(), $this->indentLevel) .
str_repeat($this->getIndentCharacter(), $indentSize);
}

protected function pExpr_MethodCall(MethodCall $methodCall): string
{
if (SimpleParameterProvider::provideBoolParameter(Option::NEW_LINE_ON_FLUENT_CALL) === false) {
Expand All @@ -482,7 +474,11 @@ protected function pExpr_MethodCall(MethodCall $methodCall): string
$arg->value->setAttribute(AttributeKey::ORIGINAL_NODE, null);
}

return $this->pDereferenceLhs($methodCall->var) . "\n" . $this->resolveIndentSpaces() . "->" . $this->pObjectProperty($methodCall->name)
return $this->pDereferenceLhs(
$methodCall->var
) . "\n" . $this->resolveIndentSpaces() . '->' . $this->pObjectProperty(
$methodCall->name
)
. '(' . $this->pMaybeMultiline($methodCall->args) . ')';
}

Expand All @@ -503,6 +499,14 @@ protected function pParam(Param $param): string
. ($param->default instanceof Expr ? ' = ' . $this->p($param->default) : '');
}

private function resolveIndentSpaces(): string
{
$indentSize = SimpleParameterProvider::provideIntParameter(Option::INDENT_SIZE);

return str_repeat($this->getIndentCharacter(), $this->indentLevel) .
str_repeat($this->getIndentCharacter(), $indentSize);
}

/**
* Must be a method to be able to react to changed parameter in tests
*/
Expand Down

0 comments on commit 93e0259

Please sign in to comment.