matteosister / GitElephant

An abstraction layer for git written in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More PHP 8.1 deprecations

jurgenhaas opened this issue · comments

The first one is

Deprecation Notice: array_splice(): Passing null to parameter #2 ($offset) of type int is deprecated in /drupal/vendor/cypresslab/gitelephant/src/GitElephant/Objects/Remote.php:269

What gets passed to that function is this array:

Array
(
    [remoteBranches] => 
    [localBranches] => 6
    [localRefs] => 
)

So, instead of remote branches and local refs being zero, they seem to be NULL.

Not sure how that needed to be fixed.

Looks like this might be the correct approach, but I'm not certain:

- $configuredRefs[$type] = array_splice($remoteDetails, $lineno);
+ $configuredRefs[$type] = $lineno === NULL ? [] : array_splice($remoteDetails, $lineno);