Use nullable type declaration as supported in versions >= PHP 7.1 (#882)

This commit is contained in:
Zach Borboa
2024-08-20 22:09:03 -04:00
committed by GitHub
parent f08eb12db8
commit d6c8c2879b
+1 -6
View File
@@ -42,12 +42,7 @@ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
* @param mixed[] $initial (optional) Existing array to convert.
* @return CaseInsensitiveArray
*/
// TODO: Use a nullable type declaration when supported versions >= PHP 7.1.
// Trying to use the nullable type declaration on PHP 7.0:
// public function __construct(?array $initial = null)
// results in:
// ParseError: syntax error, unexpected '?', expecting variable (T_VARIABLE)
public function __construct($initial = null)
public function __construct(?array $initial = null)
{
if ($initial !== null) {
foreach ($initial as $key => $value) {