Describe the bug
If inside a given context, e.g. a function, a global variable is set but never read, it is falsely reported as never used.
Describe the eclipse environment
Eclipse 2025-06
PDT 8.2
Describe your system
To Reproduce
2 warnings will be reported for the following code snippet:
Variable '$A' is never used on line 9
Variable '$C' is never used on line 9
<?php
namespace Foo;
class Bar
{
public function doSomethingWithGlobals(): void
{
global $A, $B, $C;
$A = new Bar();
if ($B) {
echo "azerty";
}
}
}
Expected behavior
The variable $A should not be considered as never used. Indeed it is a reference to the $A variable declared in the global scope and changing its value here has an impact outside the current context.
Describe the bug
If inside a given context, e.g. a function, a global variable is set but never read, it is falsely reported as never used.
Describe the eclipse environment
Eclipse 2025-06
PDT 8.2
Describe your system
To Reproduce
2 warnings will be reported for the following code snippet:
Variable '$A' is never usedon line 9Variable '$C' is never usedon line 9Expected behavior
The variable
$Ashould not be considered as never used. Indeed it is a reference to the$Avariable declared in the global scope and changing its value here has an impact outside the current context.