From 84a8b697ea26aed68748f786c36c2ffe4ffe9110 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 2 Feb 2025 20:19:33 +0100 Subject: [PATCH 1/2] [TASK] Remove the deprecated `OutputFormat::level()` This method is an inconsistently-named alias of `OutputFormat::getIndentationLevel()`. Fixes #869 --- CHANGELOG.md | 1 + src/OutputFormat.php | 8 -------- src/OutputFormatter.php | 2 +- tests/Unit/OutputFormatTest.php | 11 ----------- 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed27efb31..fd19267bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Please also have a look at our ### Removed +- Remove `OutputFormat::level()` (#874)) - Remove expansion of shorthand properties (#838) - Remove `Parser::setCharset/getCharset` (#808) - Remove `Rule::getValues()` (#582) diff --git a/src/OutputFormat.php b/src/OutputFormat.php index ce53bb1bc..2b9404d71 100644 --- a/src/OutputFormat.php +++ b/src/OutputFormat.php @@ -287,14 +287,6 @@ public function getFormatter() return $this->oFormatter; } - /** - * @return int - */ - public function level() - { - return $this->iIndentationLevel; - } - /** * Creates an instance of this class without any particular formatting settings. */ diff --git a/src/OutputFormatter.php b/src/OutputFormatter.php index 7ef86a3c0..0dfb59dc9 100644 --- a/src/OutputFormatter.php +++ b/src/OutputFormatter.php @@ -208,6 +208,6 @@ private function prepareSpace($sSpaceString): string */ private function indent(): string { - return \str_repeat($this->oFormat->sIndentation, $this->oFormat->level()); + return \str_repeat($this->oFormat->sIndentation, $this->oFormat->getIndentationLevel()); } } diff --git a/tests/Unit/OutputFormatTest.php b/tests/Unit/OutputFormatTest.php index 512df67fc..2538bbe2e 100644 --- a/tests/Unit/OutputFormatTest.php +++ b/tests/Unit/OutputFormatTest.php @@ -833,17 +833,6 @@ public function getFormatterCalledTwoTimesReturnsSameInstance(): void self::assertSame($firstCallResult, $secondCallResult); } - /** - * @test - */ - public function levelReturnsIndentationLevel(): void - { - $value = 4; - $this->subject->setIndentationLevel($value); - - self::assertSame($value, $this->subject->level()); - } - /** * @test */ From 0c78106c9832b674c50cff19902770da178a6cac Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 2 Feb 2025 20:32:57 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md Co-authored-by: JakeQZ --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd19267bf..eb1dc6a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ Please also have a look at our ### Removed -- Remove `OutputFormat::level()` (#874)) +- Remove `OutputFormat::level()` (#874) - Remove expansion of shorthand properties (#838) - Remove `Parser::setCharset/getCharset` (#808) - Remove `Rule::getValues()` (#582)