Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

forrest79
Copy link
Contributor

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).

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.
Copy link
Member

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

Copy link
Contributor Author

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?

website/src/writing-php-code/phpdoc-types.md Outdated Show resolved Hide resolved

`trait-string` is a string representing a trait.

`enum-string` is a string representing an enum.
Copy link
Member

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

Copy link
Contributor Author

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`
Copy link
Contributor

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

Copy link
Contributor Author

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.

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 this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.