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

[PropertyInfo] Get short description from promoted properties inPhpDocExtractor#59540

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

Open
wuchen90 wants to merge1 commit intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromwuchen90:fix-phpdoc-extractor

Conversation

wuchen90
Copy link
Contributor

@wuchen90wuchen90 commentedJan 17, 2025
edited
Loading

QA
Branch?6.4
Bug fix?yes
LicenseMIT

Currently this kind of phpdoc doesn't work to get description:

class Foo {/**   * @param mixed $foo This description can't be get by PhpDocExtractor   */publicfunction__construct(public$foo,  ) {}}

Whereas this one works:

class Foo {publicfunction__construct(/** @var mixed $foo This description can be get by PhpDocExtractor */public$foo,  ) {}}

valtzu reacted with thumbs up emoji
@OskarStark
Copy link
Contributor

This is a feature and should target 7.3

mtarld reacted with thumbs up emoji

@OskarStarkOskarStark modified the milestones:6.4,7.3Jan 17, 2025
@wuchen90
Copy link
ContributorAuthor

wuchen90 commentedJan 17, 2025
edited
Loading

@OskarStark

This is a feature and should target 7.3

I don't know if this is really a feature because it works well with@var annotation.
Only, when we document a method, we usually use@param and not@var.

Beside, this code below points out that we support promoted properties:

case$reflectionProperty?->isPromoted() &&$docBlock =$this->getDocBlockFromConstructor($class,$property):

Copy link
Contributor

@mtarldmtarld left a comment

Choose a reason for hiding this comment

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

Can you update the changelog as well, as it's a feature?


$paramDescription = $param->getDescription()?->render();

if (null !== $paramDescription && '' !== $paramDescription) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (null !==$paramDescription &&'' !==$paramDescription) {
if ($paramDescription) {

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Are you sure?

<?php$paramDescription ='0';echo$paramDescription ?'ok' :'ko';// 'ko'echonull !==$paramDescription &&'' !==$paramDescription ?'ok' :'ko';// 'ok'

Choose a reason for hiding this comment

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

not sure0 a useful description either

Copy link
ContributorAuthor

@wuchen90wuchen90Jan 31, 2025
edited
Loading

Choose a reason for hiding this comment

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

Trimming0 won't make it less predictable?
I mean in the way that, from the user point of view, we naturally expect that empty string or null can be skipped.
But other than these two cases, shouldn't we return what the user has input or is it what Symfony used to do for this kind of code?
If we skip0 then I should add a test for it.

@OskarStark
Copy link
Contributor

Looking at your code change this seems like it wasn't implemented before, there is no wrong behavior, the feature is just not existent, so a feature to me.

@stof
Copy link
Member

I think the implementation would now read@param in docblock of any properties, not just for the case of reading the constructor docblock for a promoted property.

mtarld reacted with thumbs up emoji

Copy link
ContributorAuthor

@wuchen90wuchen90 left a comment

Choose a reason for hiding this comment

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

Target branch changed to 7.3.


$paramDescription = $param->getDescription()?->render();

if (null !== $paramDescription && '' !== $paramDescription) {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Are you sure?

<?php$paramDescription ='0';echo$paramDescription ?'ok' :'ko';// 'ko'echonull !==$paramDescription &&'' !==$paramDescription ?'ok' :'ko';// 'ok'

@mtarld
Copy link
Contributor

Indeed, forgot about it, you can keepnull !== $paramDescription && '' !== $paramDescription then 🙂


$paramDescription = $param->getDescription()?->render();

if (null !== $paramDescription && '' !== $paramDescription) {

Choose a reason for hiding this comment

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

not sure0 a useful description either

@OskarStarkOskarStark changed the title[PropertyInfo] Get short description from promoted properties in PhpDocExtractor[PropertyInfo] Get short description from promoted properties inPhpDocExtractorFeb 10, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@mtarldmtarldmtarld requested changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@chalasrchalasrAwaiting requested review from chalasr

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

7 participants
@wuchen90@OskarStark@stof@mtarld@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp