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

parameter with ? triggers error where it should not #1997

Closed
lyrixx opened this Issue Mar 14, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@lyrixx
Copy link

lyrixx commented Mar 14, 2019

Summary of a problem or a feature request

PHPStan should not complain when we don't pass a parameter to a fonction that has the following typehint ?string

Code snippet that reproduces the problem

function hello(?string $string)
{
	
}

hello();

https://phpstan.org/r/d9cfa0b6-6569-4654-af65-4135e3f69a0d

Expected output

nothing :)

@ondrejmirtes

This comment has been minimized.

Copy link
Member

ondrejmirtes commented Mar 14, 2019

? means nullable, not optional. Such code crashes: https://3v4l.org/V1uAW

@lyrixx

This comment has been minimized.

Copy link
Author

lyrixx commented Mar 14, 2019

Oups, indeed 👍 Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.