Skip to content

Fix PHP 8.5 deprecation: null as array offset in isArgument()#210

Open
hmennen90 wants to merge 1 commit intothephpleague:mainfrom
hmennen90:fix/php85-null-array-offset
Open

Fix PHP 8.5 deprecation: null as array offset in isArgument()#210
hmennen90 wants to merge 1 commit intothephpleague:mainfrom
hmennen90:fix/php85-null-array-offset

Conversation

@hmennen90
Copy link
Copy Markdown

Problem

PHP 8.5 deprecates using null as an array offset. Argument::prefix() and Argument::longPrefix() can return null, which was used as array keys in Manager::isArgument():

Deprecated: Using null as an array offset is deprecated, use an empty string instead
in src/Argument/Manager.php on line 175

Fix

Refactored isArgument() to check each prefix individually with explicit null guards instead of building an array with potentially null keys. The behavior is unchanged — null prefixes are skipped.

prefix() and longPrefix() can return null, which was used as an array
key. PHP 8.5 deprecates using null as an array offset.

Refactored to check each prefix individually with explicit null guards
instead of building an array with potentially null keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant