-
Notifications
You must be signed in to change notification settings - Fork 426
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
Fix/native type specification #1372
Fix/native type specification #1372
Conversation
Makes sense to me 👍 Ping me please once you mark it as ready. |
@ondrejmirtes What I'm thinking right now is that adding a bool parameter to |
My idea is that there's Let's say we have: /** @return positive-int */
public function doFoo(): int
{
}
It doesn't matter much to me if it's done via some boolean parameters, or by code duplication. I'm more fan of code duplication because it's more easier to maintain in the future :) So - if you're interested in |
Also - it's not exactly the same thing, but today you can call |
Also, once /** @var string $foo */
$foo = $this->returnsInt(); // has int in native return type We can mark this |
Thank you. |
Oh, I was not aware of this. Thanks! |
Thank you very much for your comments, I'll take them into account 👍
I'm a little confused with this comment, maybe not understanding what "native type" is correctly. |
Yes, I don't see any contradiction in that :) "Native type" is a type we can rely on, it doesn't take PHPDocs into account. |
There are lot of
specifyExpressionType
that is not correct to use type as native type.phpstan-src/src/Analyser/MutatingScope.php
Lines 3376 to 3379 in 4889a27
phpstan-src/src/Analyser/MutatingScope.php
Lines 3485 to 3488 in 4889a27
phpstan-src/src/Analyser/NodeScopeResolver.php
Line 3618 in 4889a27
This PR changes to specify native types only if specified separately.