From 8aa5260eb2b9dd87564bed503c7df06ecaf7f61d Mon Sep 17 00:00:00 2001 From: Andreas Wolf Date: Thu, 29 Aug 2024 14:09:31 +0200 Subject: [PATCH] [TASK] Remove getters for readonly properties --- .../PrettyPrinterConfigurationFactory.php | 12 +++---- ...ScriptPrettyPrinterFormatConfiguration.php | 35 +++---------------- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/packages/fractor-typoscript/src/Factory/PrettyPrinterConfigurationFactory.php b/packages/fractor-typoscript/src/Factory/PrettyPrinterConfigurationFactory.php index dd4bb09..b1a3a60 100644 --- a/packages/fractor-typoscript/src/Factory/PrettyPrinterConfigurationFactory.php +++ b/packages/fractor-typoscript/src/Factory/PrettyPrinterConfigurationFactory.php @@ -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); @@ -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(); } diff --git a/packages/fractor-typoscript/src/ValueObject/TypoScriptPrettyPrinterFormatConfiguration.php b/packages/fractor-typoscript/src/ValueObject/TypoScriptPrettyPrinterFormatConfiguration.php index d8c9420..832f692 100644 --- a/packages/fractor-typoscript/src/ValueObject/TypoScriptPrettyPrinterFormatConfiguration.php +++ b/packages/fractor-typoscript/src/ValueObject/TypoScriptPrettyPrinterFormatConfiguration.php @@ -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 ) { } @@ -43,29 +43,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; - } }