phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

[FR] Nested assignments usage: scalar assignments

Open orklah opened this issue 5 years ago • 0 comments

Description (screenshot):

For the following code:

$foo = $bar = false;

If we apply the quick fix of the "Nested assignments usage" inspection we get this result:

$bar = false;
$foo = $bar;

While this is the correct meaning of the original statement, it is not very clear. Moreover, for scalar values, it is rarely the meaning the developper put behind that statement (assign multiple values at once to initialize them).

I think this code would be much greater on those levels:

$bar = false;
$foo = false;

However, this can only be applied to scalar values (and null). If it's not possible to make the change for everyone, maybe consider introducing a setting to activate this behaviour?

orklah avatar Feb 26 '19 19:02 orklah