phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

Incorrect triggering of PHP0421 warning: The variable '$...' is assigned, but its value is never used

Open coderapers opened this issue 1 year ago • 3 comments

Hi.

Why when I use assignment to array by just created variable Devsense reports me PHP0421 warning? Variable will be used in next code line.

image

coderapers avatar Mar 31 '24 09:03 coderapers

Thank you for reporting that, it looks like a bug.

jakubmisek avatar Mar 31 '24 16:03 jakubmisek

Code to reproduce:

$form[0] = $container = new ArrayObject;
$container[1] = 123;

jakubmisek avatar Mar 31 '24 16:03 jakubmisek

$form[0] = $container = new ArrayObject; $container[1] = 123;

Ahmedahasssan avatar Apr 27 '24 03:04 Ahmedahasssan

Fixed in the next update (1.47 pre-release or 1.48), thanks!

jakubmisek avatar May 29 '24 14:05 jakubmisek