phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

"Property is used only in constructor" doesn't take care of trait

Open COil opened this issue 5 years ago • 2 comments

Subject Details
Plugin Php Inspections (EA Ultimate)
Language level PHP 7.2

Current behaviour

I have this warning "[EA] Property is used only in constructor, perhaps we are dealing with dead code here." because the property is used in a trait only.

Expected behaviour

No warning. Should look into trait ?

Environment details

class BlogController extends AbstractController
{
    use Post13Trait,Post26Trait,Post51Trait,Post59Trait;

This Post13Trait uses the property that is reported by the warning.

The trait :

/**
 * @property ValidatorInterface $validator
 */
trait Post13Trait
{

COil avatar Jan 05 '20 08:01 COil

Yep, it should look into traits as well. Thank you for pointing out @COil!

kalessil avatar Jan 05 '20 21:01 kalessil

@COil: checked, the inspection looks up for traits as well. Will it be possible to share simplified case with the false-positive?

kalessil avatar Feb 02 '20 06:02 kalessil