Skip to content

Commit cd51281

Browse files
authored
[CLEANUP] Avoid Hungarian notation in OutputFormat (part 9) (#1126)
Also rename the getters to match the new property names. Part of #756
1 parent 1de81af commit cd51281

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
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

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)