-
-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Commit 6b82a86 in PR #1215 temporarily silences a PHP 8.5 "Using null as an array offset" deprecation in the Tokenizer layer dealing with the ?
character.
As per the commit message:
When running the
NullsafeObjectOperatorTest
, the "Using null as an array offset" deprecation gets triggered in the tokenizer layer handling re-tokenization toT_NULLABLE
and/orT_INLINE_THEN
.This should only be possible if the below code at the top of the loop would result in
$tokenType
beingnull
, which shouldn't be possible....
PHP_CodeSniffer/src/Tokenizers/PHP.php
Lines 2254 to 2258 in f1c9394
if (is_array($tokens[$i]) === true) { $tokenType = $tokens[$i][0]; } else { $tokenType = $tokens[$i]; } With this conundrum in mind, I'm electing to (temporarily) silence the deprecation notice for now until there is more time to investigate in more depth.
This issue is a reminder to investigate the above before PHP 9.0 comes round and to determine a permanent solution.
As that part of the Tokenizer is not sufficiently covered by dedicated tests, more tests will need to be put in place as well to validate and safeguard the permanent solution.