Phpinspectionsea: Unused constructor dependencies inspection should happen only in assignments

Created on 22 Apr 2019  路  3Comments  路  Source: kalessil/phpinspectionsea

| Subject | Details |
| :------------- | :---------------------------------------------------------------------------- |
| Plugin | U2.0.15 |

Current behaviour

Not exactly a bug, but it will avoid a lot of inspections about the same problem by limiting current inspection to the assignment, instead of all usages.

image

bug / false-positive fixed

All 3 comments

In this case error should not be rerported:

class User{
 private $name='';
 function __construct(){
  file_put_contents($this->name . '.txt', 'data')
 }
}

This is not good. I think the main improvement will be highlighting the only first occurrence of the unused target property.

Agree, only the first one should be reported.

Fixed!

Was this page helpful?
0 / 5 - 0 ratings