Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
[TypeInfo] Add documentation#19554
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Korbeil commentedFeb 14, 2024
Q | A |
---|---|
Doc fix? | no |
New docs? | yes (symfony/symfony#52510) |
Applies to | 7.1 |
Fixed tickets | #19497 |
0e9ac79
tod4d6b78
CompareThere 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.
Baptiste, thanks for bootstrapping these docs.
I left some comments in some sections that I found a bit confusing or lacking so we can iterate over them. Thanks!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
use Symfony\Component\TypeInfo\Type; | ||
Type::int(); |
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 understand the examples of this block. What are we building? Is this to create something? To check something? How can I use this in a Symfony app? Thanks.
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 not a component you will use in a Symfony app. This is a component made for other components or for libraries to use.
// Then resolve types for any subject | ||
$typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns an "int" Type instance | ||
$typeResolver->resolve('bool'); // returns a "bool" Type instance |
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.
The example is not very clear because some reader won't make the connection and don't know that'bool'
here refers to a boolean property of some class.
I think we need to create a simple class first with the needed properties ... and then show the code needed to introspect the type information.
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.
It's kinda complex because it's not something designed to use "as it is" or only for very specific cases.
I tried to explain a bit better how raw string resolving works and what it is used for (basically phpDoc).
Does it help more to understand ?
.. note:: | ||
To support raw string resolving, you need to install ``phpstan/phpdoc-parser`` package. |
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 fully understand what "raw string resolving" means here.
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.
see#19554 (comment) for more details, but "raw string resolving" means you're using the resolver with a string. It is mostly designed to handle phpDoc
Uh oh!
There was an error while loading.Please reload this page.
OskarStark commentedMay 15, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Open for finishing the first docs? cc@mtarld |
Sorry for the delay, I made some changes and will try to find time to fix the remaining parts. |
1b31f40
to7766204
CompareHey there,@javiereguiluz any news ? |
7766204
tob6ffad3
Compare3631834
intosymfony:7.1Uh oh!
There was an error while loading.Please reload this page.
Baptiste, this is now merged. Thanks a lot! I'll open a new issue with some questions related to this doc to see if we can improve it. Thanks! |