From 91dd198c0166b5f6d7cd92415dda7040b1f0f14c Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Fri, 17 Jan 2025 10:34:47 +0100 Subject: [PATCH] Change type annotation to mixed due to lack of guarantees on type From usage, it very much looks like the type will always be int, but on the off chance there is some code path where this gets called with something else, type was widened to mixed for now, per disussion in #1088 --- src/Compile/Base.php | 4 ++-- src/Compile/Tag/BCPluginWrapper.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Compile/Base.php b/src/Compile/Base.php index b8d6c9b2c..33e8732e6 100644 --- a/src/Compile/Base.php +++ b/src/Compile/Base.php @@ -72,11 +72,11 @@ protected function formatParamsArray(array $_attr): array { /** * Returns attribute index for unnamed ("shorthand") attribute, or null if not allowed. * - * @param int $key + * @param string|int|null $key Index of the argument. Type should probably be narrowed to int * * @return string|int|null */ - protected function getShorthandOrder(int $key) { + protected function getShorthandOrder(mixed $key) { return $this->shorttag_order[$key] ?? null; } diff --git a/src/Compile/Tag/BCPluginWrapper.php b/src/Compile/Tag/BCPluginWrapper.php index dfb174644..09e985350 100644 --- a/src/Compile/Tag/BCPluginWrapper.php +++ b/src/Compile/Tag/BCPluginWrapper.php @@ -27,11 +27,11 @@ public function __construct($callback, bool $cacheable = true) { * For compiler plugins, we allow arbitrarily many unnamed attributes, * and just make them accessible in the order they are set. * - * @param int $key + * @param string|int|null $key Index of the argument. Type should probably be narrowed to int * - * @return int + * @return string|int|null */ - protected function getShorthandOrder(int $key): int { + protected function getShorthandOrder(mixed $key) { return $key; }