Skip to content

Commit

Permalink
[TASK] Remove getters for readonly properties
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaswolf committed Aug 29, 2024
1 parent b391440 commit 068b435
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function createPrettyPrinterConfiguration(
): PrettyPrinterConfiguration {
$prettyPrinterConfiguration = PrettyPrinterConfiguration::create();

if ($prettyPrinterFormatConfiguration->getStyle() === 'auto') {
if ($prettyPrinterFormatConfiguration->style === 'auto') {
// keep original TypoScript format
$indent = Indent::fromFile($file);

Expand All @@ -26,23 +26,23 @@ public function createPrettyPrinterConfiguration(
} else {
$prettyPrinterConfiguration = $prettyPrinterConfiguration->withTabs();
}
} elseif ($prettyPrinterFormatConfiguration->getStyle() === PrettyPrinterConfiguration::INDENTATION_STYLE_TABS) {
} elseif ($prettyPrinterFormatConfiguration->style === PrettyPrinterConfiguration::INDENTATION_STYLE_TABS) {
$prettyPrinterConfiguration = $prettyPrinterConfiguration->withTabs();
} else {
$prettyPrinterConfiguration = $prettyPrinterConfiguration->withSpaceIndentation(
$prettyPrinterFormatConfiguration->getSize()
$prettyPrinterFormatConfiguration->size
);
}

if ($prettyPrinterFormatConfiguration->shouldIndentConditions()) {
if ($prettyPrinterFormatConfiguration->indentConditions) {
$prettyPrinterConfiguration = $prettyPrinterConfiguration->withIndentConditions();
}

if ($prettyPrinterFormatConfiguration->shouldAddClosingGlobal()) {
if ($prettyPrinterFormatConfiguration->addClosingGlobal) {
$prettyPrinterConfiguration = $prettyPrinterConfiguration->withClosingGlobalStatement();
}

if ($prettyPrinterFormatConfiguration->shouldIncludeEmptyLineBreaks()) {
if ($prettyPrinterFormatConfiguration->includeEmptyLineBreaks) {
return $prettyPrinterConfiguration->withEmptyLineBreaks();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
final readonly class TypoScriptPrettyPrinterFormatConfiguration
{
public function __construct(
private int $size,
private string $style,
private bool $addClosingGlobal,
private bool $includeEmptyLineBreaks,
private bool $indentConditions
public int $size,
public string $style,
public bool $addClosingGlobal,
public bool $includeEmptyLineBreaks,
public bool $indentConditions
) {
}

Expand Down Expand Up @@ -44,29 +44,4 @@ public static function createFromParameterBag(ParameterBagInterface $parameterBa

return new self($size, $style, $addClosingGlobal, $includeEmptyLineBreaks, $indentConditions);
}

public function getSize(): int
{
return $this->size;
}

public function getStyle(): string
{
return $this->style;
}

public function shouldAddClosingGlobal(): bool
{
return $this->addClosingGlobal;
}

public function shouldIncludeEmptyLineBreaks(): bool
{
return $this->includeEmptyLineBreaks;
}

public function shouldIndentConditions(): bool
{
return $this->indentConditions;
}
}

0 comments on commit 068b435

Please sign in to comment.