matteosister / GitElephant

An abstraction layer for git written in PHP
GNU Lesser General Public License v3.0
613 stars 74 forks source link

More PHP 8.1 deprecations #185

Closed jurgenhaas closed 2 years ago

jurgenhaas commented 2 years ago

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.

jurgenhaas commented 2 years ago

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);