This commit is contained in:
xl
2023-05-25 16:59:20 +08:00
parent 3016bb54f1
commit 0f1a55462e
12 changed files with 343 additions and 430 deletions
+7 -6
View File
@@ -61,14 +61,15 @@ class HashMap implements \ArrayAccess, \IteratorAggregate
}
/**
* @param string $key
* @return mixed
*/
#[Pure] public function get(string $key): mixed
/**
* @param string $key
* @param mixed|null $default
* @return mixed
*/
#[Pure] public function get(string $key, mixed $default = null): mixed
{
if (!$this->has($key)) {
return null;
return $default;
}
return $this->lists[$key];
}