Skip to content

[CLEANUP] Avoid Hungarian notation in OutputFormat (part 7) #1121

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 8, 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
30 changes: 15 additions & 15 deletions src/OutputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,24 @@ class OutputFormat
/**
* @var string
*/
private $sSpaceBeforeOpeningBrace = ' ';
private $spaceBeforeOpeningBrace = ' ';

/**
* Content injected in and around declaration blocks.
*
* @var string
*/
private $sBeforeDeclarationBlock = '';
private $contentBeforeDeclarationBlock = '';

/**
* @var string
*/
private $sAfterDeclarationBlockSelectors = '';
private $contentAfterDeclarationBlockSelectors = '';

/**
* @var string
*/
private $sAfterDeclarationBlock = '';
private $contentAfterDeclarationBlock = '';

/**
* Indentation character(s) per level. Only applicable if newlines are used in any of the spacing settings.
Expand Down Expand Up @@ -537,69 +537,69 @@ public function setSpaceAfterListArgumentSeparators(array $separatorSpaces): sel
*/
public function getSpaceBeforeOpeningBrace(): string
{
return $this->sSpaceBeforeOpeningBrace;
return $this->spaceBeforeOpeningBrace;
}

/**
* @return $this fluent interface
*/
public function setSpaceBeforeOpeningBrace(string $whitespace): self
{
$this->sSpaceBeforeOpeningBrace = $whitespace;
$this->spaceBeforeOpeningBrace = $whitespace;

return $this;
}

/**
* @internal
*/
public function getBeforeDeclarationBlock(): string
public function getContentBeforeDeclarationBlock(): string
{
return $this->sBeforeDeclarationBlock;
return $this->contentBeforeDeclarationBlock;
}

/**
* @return $this fluent interface
*/
public function setBeforeDeclarationBlock(string $content): self
{
$this->sBeforeDeclarationBlock = $content;
$this->contentBeforeDeclarationBlock = $content;

return $this;
}

/**
* @internal
*/
public function getAfterDeclarationBlockSelectors(): string
public function getContentAfterDeclarationBlockSelectors(): string
{
return $this->sAfterDeclarationBlockSelectors;
return $this->contentAfterDeclarationBlockSelectors;
}

/**
* @return $this fluent interface
*/
public function setAfterDeclarationBlockSelectors(string $content): self
{
$this->sAfterDeclarationBlockSelectors = $content;
$this->contentAfterDeclarationBlockSelectors = $content;

return $this;
}

/**
* @internal
*/
public function getAfterDeclarationBlock(): string
public function getContentAfterDeclarationBlock(): string
{
return $this->sAfterDeclarationBlock;
return $this->contentAfterDeclarationBlock;
}

/**
* @return $this fluent interface
*/
public function setAfterDeclarationBlock(string $content): self
{
$this->sAfterDeclarationBlock = $content;
$this->contentAfterDeclarationBlock = $content;

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/RuleSet/DeclarationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,16 @@ public function render(OutputFormat $outputFormat): string
// If all the selectors have been removed, this declaration block becomes invalid
throw new OutputException('Attempt to print declaration block with missing selector', $this->lineNumber);
}
$result .= $outputFormat->getBeforeDeclarationBlock();
$result .= $outputFormat->getContentBeforeDeclarationBlock();
$result .= $outputFormat->implode(
$outputFormat->spaceBeforeSelectorSeparator() . ',' . $outputFormat->spaceAfterSelectorSeparator(),
$this->selectors
);
$result .= $outputFormat->getAfterDeclarationBlockSelectors();
$result .= $outputFormat->getContentAfterDeclarationBlockSelectors();
$result .= $outputFormat->spaceBeforeOpeningBrace() . '{';
$result .= $this->renderRules($outputFormat);
$result .= '}';
$result .= $outputFormat->getAfterDeclarationBlock();
$result .= $outputFormat->getContentAfterDeclarationBlock();
return $result;
}
}
18 changes: 9 additions & 9 deletions tests/Unit/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ public function setSpaceBeforeOpeningBraceProvidesFluentInterface(): void
/**
* @test
*/
public function getBeforeDeclarationBlockInitiallyReturnsEmptyString(): void
public function getContentBeforeDeclarationBlockInitiallyReturnsEmptyString(): void
{
self::assertSame('', $this->subject->getBeforeDeclarationBlock());
self::assertSame('', $this->subject->getContentBeforeDeclarationBlock());
}

/**
Expand All @@ -565,7 +565,7 @@ public function setBeforeDeclarationBlockSetsBeforeDeclarationBlock(): void
$value = ' ';
$this->subject->setBeforeDeclarationBlock($value);

self::assertSame($value, $this->subject->getBeforeDeclarationBlock());
self::assertSame($value, $this->subject->getContentBeforeDeclarationBlock());
}

/**
Expand All @@ -579,9 +579,9 @@ public function setBeforeDeclarationBlockProvidesFluentInterface(): void
/**
* @test
*/
public function getAfterDeclarationBlockSelectorsInitiallyReturnsEmptyString(): void
public function getContentAfterDeclarationBlockSelectorsInitiallyReturnsEmptyString(): void
{
self::assertSame('', $this->subject->getAfterDeclarationBlockSelectors());
self::assertSame('', $this->subject->getContentAfterDeclarationBlockSelectors());
}

/**
Expand All @@ -592,7 +592,7 @@ public function setAfterDeclarationBlockSelectorsSetsAfterDeclarationBlockSelect
$value = ' ';
$this->subject->setAfterDeclarationBlockSelectors($value);

self::assertSame($value, $this->subject->getAfterDeclarationBlockSelectors());
self::assertSame($value, $this->subject->getContentAfterDeclarationBlockSelectors());
}

/**
Expand All @@ -606,9 +606,9 @@ public function setAfterDeclarationBlockSelectorsProvidesFluentInterface(): void
/**
* @test
*/
public function getAfterDeclarationBlockInitiallyReturnsEmptyString(): void
public function getContentAfterDeclarationBlockInitiallyReturnsEmptyString(): void
{
self::assertSame('', $this->subject->getAfterDeclarationBlock());
self::assertSame('', $this->subject->getContentAfterDeclarationBlock());
}

/**
Expand All @@ -619,7 +619,7 @@ public function setAfterDeclarationBlockSetsAfterDeclarationBlock(): void
$value = ' ';
$this->subject->setAfterDeclarationBlock($value);

self::assertSame($value, $this->subject->getAfterDeclarationBlock());
self::assertSame($value, $this->subject->getContentAfterDeclarationBlock());
}

/**
Expand Down