Skip to content

Commit 151e015

Browse files
authored
Merge branch 'main' into cleanup/hungarian/include-end
2 parents 918cace + b43388a commit 151e015

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

src/OutputFormat.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class OutputFormat
163163
*
164164
* @var bool
165165
*/
166-
private $bRenderComments = false;
166+
private $shouldRenderComments = false;
167167

168168
/**
169169
* @var OutputFormatter|null
@@ -178,25 +178,25 @@ class OutputFormat
178178
/**
179179
* @var int
180180
*/
181-
private $iIndentationLevel = 0;
181+
private $indendationLevel = 0;
182182

183183
public function __construct() {}
184184

185185
/**
186-
* @param non-empty-string $sMethodName
186+
* @param non-empty-string $methodName
187187
* @param array<array-key, mixed> $arguments
188188
*
189189
* @return mixed
190190
*
191191
* @throws \Exception
192192
*/
193-
public function __call(string $sMethodName, array $arguments)
193+
public function __call(string $methodName, array $arguments)
194194
{
195-
if (\method_exists(OutputFormatter::class, $sMethodName)) {
195+
if (\method_exists(OutputFormatter::class, $methodName)) {
196196
// @deprecated since 8.8.0, will be removed in 9.0.0. Call the method on the formatter directly instead.
197-
return \call_user_func_array([$this->getFormatter(), $sMethodName], $arguments);
197+
return \call_user_func_array([$this->getFormatter(), $methodName], $arguments);
198198
} else {
199-
throw new \Exception('Unknown OutputFormat method called: ' . $sMethodName);
199+
throw new \Exception('Unknown OutputFormat method called: ' . $methodName);
200200
}
201201
}
202202

@@ -643,17 +643,17 @@ public function setIgnoreExceptions(bool $ignoreExceptions): self
643643
/**
644644
* @internal
645645
*/
646-
public function getRenderComments(): bool
646+
public function shouldRenderComments(): bool
647647
{
648-
return $this->bRenderComments;
648+
return $this->shouldRenderComments;
649649
}
650650

651651
/**
652652
* @return $this fluent interface
653653
*/
654654
public function setRenderComments(bool $renderComments): self
655655
{
656-
$this->bRenderComments = $renderComments;
656+
$this->shouldRenderComments = $renderComments;
657657

658658
return $this;
659659
}
@@ -663,7 +663,7 @@ public function setRenderComments(bool $renderComments): self
663663
*/
664664
public function getIndentationLevel(): int
665665
{
666-
return $this->iIndentationLevel;
666+
return $this->indendationLevel;
667667
}
668668

669669
/**
@@ -689,7 +689,7 @@ public function nextLevel(): self
689689
{
690690
if ($this->nextLevelFormat === null) {
691691
$this->nextLevelFormat = clone $this;
692-
$this->nextLevelFormat->iIndentationLevel++;
692+
$this->nextLevelFormat->indendationLevel++;
693693
$this->nextLevelFormat->outputFormatter = null;
694694
}
695695
return $this->nextLevelFormat;

src/OutputFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function removeLastSemicolon(string $string): string
208208

209209
public function comments(Commentable $commentable): string
210210
{
211-
if (!$this->outputFormat->getRenderComments()) {
211+
if (!$this->outputFormat->shouldRenderComments()) {
212212
return '';
213213
}
214214

src/Parsing/ParserState.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,27 +349,27 @@ public function consumeUntil(
349349
array &$comments = []
350350
): string {
351351
$stopCharacters = \is_array($stopCharacters) ? $stopCharacters : [$stopCharacters];
352-
$out = '';
352+
$consumedCharacters = '';
353353
$start = $this->currentPosition;
354354

355355
while (!$this->isEnd()) {
356-
$char = $this->consume(1);
357-
if (\in_array($char, $stopCharacters, true)) {
356+
$character = $this->consume(1);
357+
if (\in_array($character, $stopCharacters, true)) {
358358
if ($includeEnd) {
359-
$out .= $char;
359+
$consumedCharacters .= $character;
360360
} elseif (!$consumeEnd) {
361-
$this->currentPosition -= $this->strlen($char);
361+
$this->currentPosition -= $this->strlen($character);
362362
}
363-
return $out;
363+
return $consumedCharacters;
364364
}
365-
$out .= $char;
365+
$consumedCharacters .= $character;
366366
if ($comment = $this->consumeComment()) {
367367
$comments[] = $comment;
368368
}
369369
}
370370

371371
if (\in_array(self::EOF, $stopCharacters, true)) {
372-
return $out;
372+
return $consumedCharacters;
373373
}
374374

375375
$this->currentPosition = $start;

tests/Unit/OutputFormatTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,9 @@ public function setIgnoreExceptionsProvidesFluentInterface(): void
688688
/**
689689
* @test
690690
*/
691-
public function getRenderCommentsInitiallyReturnsFalse(): void
691+
public function shouldRenderCommentsInitiallyReturnsFalse(): void
692692
{
693-
self::assertFalse($this->subject->getRenderComments());
693+
self::assertFalse($this->subject->shouldRenderComments());
694694
}
695695

696696
/**
@@ -702,7 +702,7 @@ public function setRenderCommentsSetsRenderComments(bool $value): void
702702
{
703703
$this->subject->setRenderComments($value);
704704

705-
self::assertSame($value, $this->subject->getRenderComments());
705+
self::assertSame($value, $this->subject->shouldRenderComments());
706706
}
707707

708708
/**
@@ -1041,7 +1041,7 @@ public function createCompactReturnsInstanceWithRenderCommentsDisabled(): void
10411041
{
10421042
$newInstance = OutputFormat::createCompact();
10431043

1044-
self::assertFalse($newInstance->getRenderComments());
1044+
self::assertFalse($newInstance->shouldRenderComments());
10451045
}
10461046

10471047
/**
@@ -1170,6 +1170,6 @@ public function createPrettyReturnsInstanceWithRenderCommentsEnabled(): void
11701170
{
11711171
$newInstance = OutputFormat::createPretty();
11721172

1173-
self::assertTrue($newInstance->getRenderComments());
1173+
self::assertTrue($newInstance->shouldRenderComments());
11741174
}
11751175
}

0 commit comments

Comments
 (0)