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

No "false" and "true" as per phpDocumentor docs? #14

Closed
jesseschalken opened this issue Jan 14, 2016 · 4 comments · Fixed by #108
Closed

No "false" and "true" as per phpDocumentor docs? #14

jesseschalken opened this issue Jan 14, 2016 · 4 comments · Fixed by #108

Comments

@jesseschalken
Copy link

According to http://www.phpdoc.org/docs/latest/references/phpdoc/types.html, false and true are valid types in PHPDoc, but I can't find any representation in the classes implementing phpDocumentor\Reflection\Type. Is it missing?

Thanks

@jaapio
Copy link
Member

jaapio commented Apr 30, 2017

True and false are resolved as boolean. Since they actually are. We won't add them as a type.

@jaapio jaapio closed this as completed Apr 30, 2017
@jesseschalken
Copy link
Author

false|string is not the same as bool|string. What if I want to document the fact that a function may only return false (eg in the case of failure, like many PHP builtins) but will never return true?

@voku
Copy link
Contributor

voku commented May 5, 2020

I try to auto-generate my README (https://github.com/voku/portable-utf8/blob/master/build/generate_docs.php) and now my documentation has bool|string but in the code I use false|string. :-/

@jaapio Has the behavior changed in the last years, so that I can return the correct value?


EDIT: if someone also need a false pseudo type, here is a example: https://github.com/voku/Simple-PHP-Code-Parser/blob/54b961a3c7a75d91d7d2f99d1518e451edf1f191/src/voku/SimplePhpParser/Model/PhpFileHelper.php#L55

@jaapio
Copy link
Member

jaapio commented May 5, 2020

I'm reopening this issue because of an internal discussion about the handling of pseudo types. Since this library is used in so many packages we need to be careful with BC changes. Of course, there are many ways to ensure things won't break.

I cannot say anything about a time path when we are introducing this feature.

First thing we came up with was the introduction of a False class that would represent False and entends Boolean. But I personally dislike the ability to extend Boolean and interface would be better so we can keep the implementations closed.

We will not introduce all pseudo types as classes, some types like bool will be interpreted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants