-
-
Notifications
You must be signed in to change notification settings - Fork 931
Update phpdoc-types.md #13659
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
base: 2.1.x
Are you sure you want to change the base?
Update phpdoc-types.md #13659
Conversation
I'm using this page as a reference doc for PHPDoc types, and I was surprised that some types are missing here (according to `TypeNodeResolver.php`).
|
||
`uppercase-string` accepts strings where `strtoupper($string) === $string` is true. There is also non empty version `non-empty-uppercase-string`. | ||
|
||
`__stringandstringable` is any string or object implementing `Stringable` interface or object with a magic `__toString()` method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is private and undocumented for a reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I understand __stringandstringable
- but I saw this type in PHPStan error report, and it was a little bit strange that there is no mention in official documentation about it. What about some "internals" section in the docs?
Can I ask why is private uppercase-string
when lowercase-string
is documented?
|
||
`trait-string` is a string representing a trait. | ||
|
||
`enum-string` is a string representing an enum. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to call much attention to interface-
, trait-
and enum-
because they don't actually enforce the right types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the same question as for __stringandstringable
- what about some internal/other section, just to have these types mention in the doc?
* `array` | ||
* `number` (or `numeric`) | ||
* `scalar`, `non-empty-scalar`, `empty-scalar` | ||
* `array`, `non-empty-array`, `associative-array` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it weird to consider non-empty-array as a basic type here without explanation, while there is a section for no-empty-string ?
Same question for non-empty-scalar and empty-scalar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but I didn't want to start new sections for one or two types. On the other hand, scalar
is not PHP type either, and it is mentioned here too.
I'm using this page as a reference doc for PHPDoc types, and I was surprised that some types are missing here (according to
TypeNodeResolver.php
).