Skip to content

Errors in a trait reported for wrong file #3464

@alecpl

Description

@alecpl

PHPStan version: 0.12.28
Larastan version: 0.6.0

I have a trait and a class (in two files, Test.php and TestTrait.php, files are in different directories):

trait TestTrait {
    function someMethod() {
        $var = ''; // @phpstan-ignore-line
    }
}
class Test {
    use TestTrait;
    ...
}

Output is this:

 ------ ------------------------------------------------- 
  Line   tests/Test.php  
 ------ ------------------------------------------------- 
  3     No error to ignore is reported on line 3.   
 ------ ------------------------------------------------- 

And this is so wrong. The line 3 in Test.php has nothing to do with the error and it is hard to find what's going on here. The file in the report should be TestTrait.php.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions