Skip to content

[CLEANUP] Improve some OutputFormat property and getter names #1099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2025
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
20 changes: 10 additions & 10 deletions src/OutputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OutputFormat
*
* @var bool
*/
private $rgbHashNotation = true;
private $usesRgbHashNotation = true;

/**
* Declaration format
Expand All @@ -27,7 +27,7 @@ class OutputFormat
*
* @var bool
*/
private $semicolonAfterLastRule = true;
private $renderSemicolonAfterLastRule = true;

/**
* Spacing
Expand Down Expand Up @@ -272,35 +272,35 @@ public function setStringQuotingType(string $quotingType): self
/**
* @internal
*/
public function getRGBHashNotation(): bool
public function usesRgbHashNotation(): bool
{
return $this->rgbHashNotation;
return $this->usesRgbHashNotation;
}

/**
* @return $this fluent interface
*/
public function setRGBHashNotation(bool $rgbHashNotation): self
public function setRGBHashNotation(bool $usesRgbHashNotation): self
{
$this->rgbHashNotation = $rgbHashNotation;
$this->usesRgbHashNotation = $usesRgbHashNotation;

return $this;
}

/**
* @internal
*/
public function getSemicolonAfterLastRule(): bool
public function shouldRenderSemicolonAfterLastRule(): bool
{
return $this->semicolonAfterLastRule;
return $this->renderSemicolonAfterLastRule;
}

/**
* @return $this fluent interface
*/
public function setSemicolonAfterLastRule(bool $semicolonAfterLastRule): self
public function setSemicolonAfterLastRule(bool $renderSemicolonAfterLastRule): self
{
$this->semicolonAfterLastRule = $semicolonAfterLastRule;
$this->renderSemicolonAfterLastRule = $renderSemicolonAfterLastRule;

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/OutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function implode(string $separator, array $values, bool $increaseLevel =

public function removeLastSemicolon(string $string): string
{
if ($this->outputFormat->getSemicolonAfterLastRule()) {
if ($this->outputFormat->shouldRenderSemicolonAfterLastRule()) {
return $string;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Value/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function render(OutputFormat $outputFormat): string
private function shouldRenderAsHex(OutputFormat $outputFormat): bool
{
return
$outputFormat->getRGBHashNotation()
$outputFormat->usesRgbHashNotation()
&& $this->getRealName() === 'rgb'
&& $this->allComponentsAreNumbers();
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function setStringQuotingTypeProvidesFluentInterface(): void
/**
* @test
*/
public function getRGBHashNotationInitiallyReturnsTrue(): void
public function usesRgbHashNotationInitiallyReturnsTrue(): void
{
self::assertTrue($this->subject->getRGBHashNotation());
self::assertTrue($this->subject->usesRgbHashNotation());
}

/**
Expand All @@ -78,7 +78,7 @@ public function setRGBHashNotationSetsRGBHashNotation(bool $value): void
{
$this->subject->setRGBHashNotation($value);

self::assertSame($value, $this->subject->getRGBHashNotation());
self::assertSame($value, $this->subject->usesRgbHashNotation());
}

/**
Expand All @@ -92,9 +92,9 @@ public function setRGBHashNotationProvidesFluentInterface(): void
/**
* @test
*/
public function getSemicolonAfterLastRuleInitiallyReturnsTrue(): void
public function shouldRenderSemicolonAfterLastRuleInitiallyReturnsTrue(): void
{
self::assertTrue($this->subject->getSemicolonAfterLastRule());
self::assertTrue($this->subject->shouldRenderSemicolonAfterLastRule());
}

/**
Expand All @@ -106,7 +106,7 @@ public function setSemicolonAfterLastRuleSetsSemicolonAfterLastRule(bool $value)
{
$this->subject->setSemicolonAfterLastRule($value);

self::assertSame($value, $this->subject->getSemicolonAfterLastRule());
self::assertSame($value, $this->subject->shouldRenderSemicolonAfterLastRule());
}

/**
Expand Down