From 255698a99d47bd0c5d816fde2c7a388bf482e980 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 9 Feb 2025 20:56:52 +0100 Subject: [PATCH] [TASK] Deprecate method forwarding `OutputFormat` to `OutputFormatter` Instead, the corresponding method on the formatter should be called directly. This increases type safety and helps static code analysis. Also, it makes the code easier to understand. --- CHANGELOG.md | 2 ++ src/OutputFormat.php | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b60f6e61b..362a65466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ Please also have a look at our ### Deprecated +- Deprecate magic method forwarding from `OutputFormat` to `OutputFormatter` + (#894) - Deprecate greedy calculation of selector specificity (#1018) - Deprecate `__toString()` (#1006) - `OutputFormat` properties for space around list separators as an array (#880) diff --git a/src/OutputFormat.php b/src/OutputFormat.php index 151e698c6..1aa410a69 100644 --- a/src/OutputFormat.php +++ b/src/OutputFormat.php @@ -244,6 +244,7 @@ public function set($aNames, $mValue) public function __call(string $sMethodName, array $aArguments) { if (\method_exists(OutputFormatter::class, $sMethodName)) { + // @deprecated since 8.8.0, will be removed in 9.0.0. Call the method on the formatter directly instead. return \call_user_func_array([$this->getFormatter(), $sMethodName], $aArguments); } else { throw new \Exception('Unknown OutputFormat method called: ' . $sMethodName);