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
I have the following stub file
<?php /** * We can consider that this method will never throw an exception * * @throws void */ function random_int(int $min, int $max): int {}
And I added my php.stub file to the stubFiles section of my phpstan.neon. I also use missingCheckedExceptionInThrows.
php.stub
stubFiles
missingCheckedExceptionInThrows
When I use random_int I would expect no error from phpstan but I get
random_int
... throws checked exception Exception but it's missing from the PHPDoc @throws tag
Am I doing something wrong or would it be possible that the throws void is not correctly handled in a stub file for native functions.
Sure, trying to integrate the exceptions checks.
The text was updated successfully, but these errors were encountered:
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
Sorry, something went wrong.
I see that https://github.com/phpstan/phpstan-src/blob/1.8.x/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php doesn't use the stub file to override the @throws type and it's easy to fix. Consider sending a PR, thanks.
@throws
This is an example how to test stubs-related problems: https://github.com/phpstan/phpstan-src/blob/1.8.x/tests/PHPStan/Analyser/ConditionalReturnTypeFromMethodStubTest.php
Thanks I'll take a look.
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.
Successfully merging a pull request may close this issue.
Bug report
I have the following stub file
And I added my
php.stub
file to thestubFiles
section of my phpstan.neon.I also use
missingCheckedExceptionInThrows
.Expected output
When I use
random_int
I would expect no error from phpstan but I getAm I doing something wrong or would it be possible that the throws void is not correctly handled in a stub file for native functions.
Did PHPStan help you today? Did it make you happy in any way?
Sure, trying to integrate the exceptions checks.
The text was updated successfully, but these errors were encountered: