@@ -18,8 +18,8 @@ class HLookup extends LookupBase
18
18
* in the same column based on the index_number.
19
19
*
20
20
* @param mixed $lookupValue The value that you want to match in lookup_array
21
- * @param array $lookupArray The range of cells being searched
22
- * @param array|float|int|string $indexNumber The row number in table_array from which the matching value must be returned.
21
+ * @param mixed[][] $lookupArray The range of cells being searched
22
+ * @param array<mixed> |float|int|string $indexNumber The row number in table_array from which the matching value must be returned.
23
23
* The first row is 1.
24
24
* @param mixed $notExactMatch determines if you are looking for an exact match based on lookup_value
25
25
*
@@ -49,6 +49,7 @@ public static function lookup(mixed $lookupValue, $lookupArray, $indexNumber, mi
49
49
50
50
$ firstkey = $ f [0 ] - 1 ;
51
51
$ returnColumn = $ firstkey + $ indexNumber ;
52
+ /** @var mixed[][] $lookupArray */
52
53
$ firstColumn = array_shift ($ f ) ?? 1 ;
53
54
$ rowNumber = self ::hLookupSearch ($ lookupValue , $ lookupArray , $ firstColumn , $ notExactMatch );
54
55
@@ -62,6 +63,7 @@ public static function lookup(mixed $lookupValue, $lookupArray, $indexNumber, mi
62
63
63
64
/**
64
65
* @param mixed $lookupValue The value that you want to match in lookup_array
66
+ * @param mixed[][] $lookupArray
65
67
* @param int|string $column
66
68
*/
67
69
private static function hLookupSearch (mixed $ lookupValue , array $ lookupArray , $ column , bool $ notExactMatch ): ?int
@@ -71,8 +73,10 @@ private static function hLookupSearch(mixed $lookupValue, array $lookupArray, $c
71
73
$ rowNumber = null ;
72
74
foreach ($ lookupArray [$ column ] as $ rowKey => $ rowData ) {
73
75
// break if we have passed possible keys
76
+ /** @var string $rowKey */
74
77
$ bothNumeric = is_numeric ($ lookupValue ) && is_numeric ($ rowData );
75
78
$ bothNotNumeric = !is_numeric ($ lookupValue ) && !is_numeric ($ rowData );
79
+ /** @var scalar $rowData */
76
80
$ cellDataLower = StringHelper::strToLower ((string ) $ rowData );
77
81
78
82
if (
@@ -96,6 +100,11 @@ private static function hLookupSearch(mixed $lookupValue, array $lookupArray, $c
96
100
return $ rowNumber ;
97
101
}
98
102
103
+ /**
104
+ * @param mixed[] $lookupArray
105
+ *
106
+ * @return mixed[]
107
+ */
99
108
private static function convertLiteralArray (array $ lookupArray ): array
100
109
{
101
110
if (array_key_exists (0 , $ lookupArray )) {
0 commit comments