Skip to content
New issue

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

Nullable parent return type #5529

Closed
samsonasik opened this issue Aug 25, 2021 · 3 comments
Closed

Nullable parent return type #5529

samsonasik opened this issue Aug 25, 2021 · 3 comments

Comments

@samsonasik
Copy link

Bug report

On PHPStan 0.12.96, given the following code:

class ParentClass
{}

class HelloWorld extends ParentClass
{
	public function run(): ?parent
	{
		if (rand(0,1)) {
			return $this;
		}
		
		return null;
	}
}

produce error:

Internal error: parent type is not supported here Run PHPStan with --debug option and post the stack trace to: https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md

ref https://phpstan.org/r/cde459ea-4602-4078-aef6-ac5fafe6eac1

Expected output

It should not error.

@ondrejmirtes
Copy link
Member

Hi, can you please follow the error message? Thank you.

Run PHPStan with --debug option and post the stack trace

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@30c9b01

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants