We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a method in a trait has the return type hint static and returns $this Phan will report an error like:
static
$this
PhanTypeMismatchReturn Returning $this of type \TestTrait but test() is declared to return static
https://phan.github.io/demo/?code=%3C%3Fphp%0Atrait+TestTrait+%7B%0A++++public+function+test%28%29+%3A+static+%7B%0A++++++++return+%24this%3B%0A++++%7D%0A%7D%0A%0Aclass+TestClass+%7B%0A++++use+TestTrait%3B%0A%7D%0A%0A%24tc+%3D+new+TestClass%28%29%3B%0A%24tc-%3Etest%28%29%3B
Phan 5.4.3 php-ast version 1.1.1 PHP version used to run Phan: 8.1.27
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Problem
If a method in a trait has the return type hint
static
and returns$this
Phan will report an error like:PhanTypeMismatchReturn Returning $this of type \TestTrait but test() is declared to return static
Demo
https://phan.github.io/demo/?code=%3C%3Fphp%0Atrait+TestTrait+%7B%0A++++public+function+test%28%29+%3A+static+%7B%0A++++++++return+%24this%3B%0A++++%7D%0A%7D%0A%0Aclass+TestClass+%7B%0A++++use+TestTrait%3B%0A%7D%0A%0A%24tc+%3D+new+TestClass%28%29%3B%0A%24tc-%3Etest%28%29%3B
Discovery Phan version info
Phan 5.4.3
php-ast version 1.1.1
PHP version used to run Phan: 8.1.27
The text was updated successfully, but these errors were encountered: