Skip to content

Commit 5edc06b

Browse files
committed
PHP 8.4 | Fix implicitly nullable parameters
PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameters with a `null` default value, which are not explicitly declared as nullable. As this code base still has a minimum supported PHP version of PHP 5.6, changing these parameters to explicitly nullable is not an option as that syntax was only introduced in PHP 7.1. With that in mind, I'm proposing to change the default value of the parameters to comply with the type declaration. Even though this is not a `final` class, this is not a breaking change for two reasons: 1. The signature check does not get applied to constructors. 2. Even if it did, default values can be different between parent vs child, as long as they comply with the expected type. Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
1 parent 2d1da47 commit 5edc06b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cli/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ class Table {
4444
* @param array $rows The rows of data for this table. Optional.
4545
* @param array $footers Footers used in this table. Optional.
4646
*/
47-
public function __construct(array $headers = null, array $rows = null, array $footers = null) {
47+
public function __construct(array $headers = array(), array $rows = array(), array $footers = array()) {
4848
if (!empty($headers)) {
4949
// If all the rows is given in $headers we use the keys from the
5050
// first row for the header values
51-
if ($rows === null) {
51+
if ($rows === array()) {
5252
$rows = $headers;
5353
$keys = array_keys(array_shift($headers));
5454
$headers = array();

0 commit comments

Comments
 (0)