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
Hello,
I am creating a library, and documenting the types of the parameters to make it easier to use it.
However, I am not relying on the documented types, but checking the received arguments to make sure they match.
Here is an example:
/** * @param positive-int $value */ function myFunction(int $value): void { if ($value < 1) { throw new Exception(); } }
The problem is that Psalm reports such validations as errors:
So I would like to tell Psalm not to use the documented parameter types.
Would it be possible to create a new setting called useDocblockParameterTypes (or something similar) to set it to false and achieve this behavior?
useDocblockParameterTypes
I have seen two similar settings (useDocblockTypes and useDocblockPropertyTypes), but they have a different effect.
useDocblockTypes
useDocblockPropertyTypes
Thanks in advance.
PS: I am willing to help with the implementation of this new feature.
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php /** * @param positive-int $value */ function myFunction(int $value): void { if ($value < 1) { throw new Exception(); } }
Psalm output (using commit 16b24bd): ERROR: DocblockTypeContradiction - 8:9 - Docblock-defined type int<1, max> for $value is never <= 1
<?php /** * @param non-empty-string $value */ function myFunction(string $value): void { if ($value === '') { throw new Exception(); } }
Psalm output (using commit 16b24bd): ERROR: TypeDoesNotContainType - 8:9 - '' cannot be identical to non-empty-string
Sorry, something went wrong.
No branches or pull requests
Hello,
I am creating a library, and documenting the types of the parameters to make it easier to use it.
However, I am not relying on the documented types, but checking the received arguments to make sure they match.
Here is an example:
The problem is that Psalm reports such validations as errors:
So I would like to tell Psalm not to use the documented parameter types.
Would it be possible to create a new setting called
useDocblockParameterTypes
(or something similar) to set it to false and achieve this behavior?I have seen two similar settings (
useDocblockTypes
anduseDocblockPropertyTypes
), but they have a different effect.Thanks in advance.
PS: I am willing to help with the implementation of this new feature.
The text was updated successfully, but these errors were encountered: