Lets try some more modern annotations for index key/value typing

This commit is contained in:
MarkBaker 2020-11-07 20:14:32 +01:00
parent 34d15b80de
commit 6e497a5fd6
1 changed files with 3 additions and 9 deletions

View File

@ -19,7 +19,7 @@ class HashTable
protected $keyMap = [];
/**
* Create a new \PhpOffice\PhpSpreadsheet\HashTable.
* Create a new HashTable.
*
* @param IComparable[] $source Optional source array to create HashTable from
*/
@ -39,7 +39,7 @@ class HashTable
public function addFromSource(?array $source = null): void
{
// Check if an array was passed
if ($source == null) {
if ($source === null) {
return;
}
@ -109,11 +109,9 @@ class HashTable
/**
* Get index for hash code.
*
* @param string $hashCode
*
* @return false|int Index
*/
public function getIndexForHashCode($hashCode)
public function getIndexForHashCode(string $hashCode)
{
return array_search($hashCode, $this->keyMap, true);
}
@ -121,8 +119,6 @@ class HashTable
/**
* Get by index.
*
* @param int $index
*
* @return IComparable
*/
public function getByIndex(int $index)
@ -137,8 +133,6 @@ class HashTable
/**
* Get by hashcode.
*
* @param string $hashCode
*
* @return IComparable
*/
public function getByHashCode(string $hashCode)