Skip to content

Commit

Permalink
Change type annotation to mixed due to lack of guarantees on type
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gkreitz committed Jan 17, 2025
1 parent ff12140 commit 91dd198
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Compile/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Compile/Tag/BCPluginWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 91dd198

Please sign in to comment.