mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-23 21:29:30 +00:00
Fix CI: Use nullable type declaration (#859)
* Use nullable type declaration
Fixes warning:
FILE: ./src/Curl/CaseInsensitiveArray.php
-------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
45 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update
| | the type to be explicitly nullable instead. Found implicitly nullable parameter:
| | $initial.
| | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
-------------------------------------------------------------------------------------------------
* Remove parameter type to fix PHP 7.0
This commit is contained in:
@@ -42,7 +42,12 @@ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
|
||||
* @param mixed[] $initial (optional) Existing array to convert.
|
||||
* @return CaseInsensitiveArray
|
||||
*/
|
||||
public function __construct(array $initial = null)
|
||||
// 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)
|
||||
{
|
||||
if ($initial !== null) {
|
||||
foreach ($initial as $key => $value) {
|
||||
|
||||
Reference in New Issue
Block a user