Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[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

Merged

Conversation

Korbeil
Copy link
Contributor

QA
Doc fix?no
New docs?yes (symfony/symfony#52510)
Applies to7.1
Fixed tickets#19497

@carsonbotcarsonbot added this to the7.1 milestoneFeb 14, 2024
@KorbeilKorbeilforce-pushed thefeature/type-info-component branch from0e9ac79 tod4d6b78CompareFebruary 14, 2024 08:17
Copy link
Member

@javiereguiluzjaviereguiluz left a 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!


use Symfony\Component\TypeInfo\Type;

Type::int();

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.

jseparovic1 reacted with thumbs up emoji
Copy link
ContributorAuthor

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

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.

jseparovic1 reacted with thumbs up emoji
Copy link
ContributorAuthor

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.

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.

Copy link
ContributorAuthor

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

@carsonbotcarsonbot changed the titleAdd base TypeInfo documentation[TypeInfo] Add base TypeInfo documentationFeb 22, 2024
@OskarStarkOskarStark changed the title[TypeInfo] Add base TypeInfo documentation[TypeInfo] Add documentationFeb 22, 2024
@OskarStark
Copy link
Contributor

OskarStark commentedMay 15, 2024
edited
Loading

Open for finishing the first docs?

cc@mtarld

@Korbeil
Copy link
ContributorAuthor

Open for finishing the first docs?

Sorry for the delay, I made some changes and will try to find time to fix the remaining parts.

OskarStark and javiereguiluz reacted with hooray emoji

@Korbeil
Copy link
ContributorAuthor

Hey there,@javiereguiluz any news ?

@javiereguiluzjaviereguiluzforce-pushed thefeature/type-info-component branch from7766204 tob6ffad3CompareJuly 2, 2024 14:44
@javiereguiluzjaviereguiluz merged commit3631834 intosymfony:7.1Jul 2, 2024
2 of 3 checks passed
@javiereguiluz
Copy link
Member

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!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

Assignees
No one assigned
Projects
None yet
Milestone
7.1
Development

Successfully merging this pull request may close these issues.

4 participants
@Korbeil@OskarStark@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp