Skip to content

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
ContributorAuthor

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uppercase-string and lowercase-string are not private, they can be used by users and thus should be documented.


`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
ContributorAuthor

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of internal types is that people should not use them and they should not be documented.

*`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
ContributorAuthor

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if numeric and other similar union types be documented under the Global type aliases section?

*`number`
*`scalar`
*`array`
*`number` (or `numeric`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number and numeric are two different types, they should be on separate lines and explained


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

The point of internal types is that people should not use them and they should not be documented.


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

uppercase-string and lowercase-string are not private, they can be used by users and thus should be documented.

Sign up for freeto 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.

4 participants

@forrest79@ondrejmirtes@mstrelan@VincentLanglet