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

Cleanup more @return annotations #42499

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Follow up of #42495, same motivation.
Automated edits, manual selection, happy review :P

@chalasr
Copy link
Member

chalasr commented Aug 12, 2021

You removed all param return descriptions from the codebase and added back the ones that make sense, right? I can't believe this is automated 😛

@nicolas-grekas
Copy link
Member Author

You removed all param descriptions from the codebase and added back the ones that make sense, right?

correct :)

@nicolas-grekas
Copy link
Member Author

If psalm errors make sense to anyone, suggestions welcome to fix them :)

src/Symfony/Component/Routing/RouteCollection.php Outdated Show resolved Hide resolved
Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

I… skimmed it. Looks good, once Psalm is happy (see @wouterj's comment).

@nicolas-grekas
Copy link
Member Author

psalm should be happy now, thanks for the help!

Copy link
Member

@wouterj wouterj left a comment

Choose a reason for hiding this comment

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

A very superficial review (only looking at the PHPdoc and method name).

Stopped somewhere around the HttpKernel component, when I realized my scrollbar wasn't functioning as a progress bar (due to GitHub collapsing all other diffs) and I just passed hallway point. I also can't deny the fact that I left more comments at the start :)

src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php Outdated Show resolved Hide resolved
src/Symfony/Bridge/Twig/Extension/RoutingExtension.php Outdated Show resolved Hide resolved
src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php Outdated Show resolved Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Application.php Outdated Show resolved Hide resolved
@@ -40,7 +40,7 @@ class XmlDumper extends Dumper
/**
* Dumps the service container as an XML string.
Copy link
Member

Choose a reason for hiding this comment

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

All these "dumps" are more "returns" right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, leaving as is for now

@@ -572,7 +572,7 @@ public function children(string $selector = null)
/**
* Returns the attribute value of the first node of the list.
*
* @return string|null The attribute value or null if the attribute does not exist
Copy link
Member

Choose a reason for hiding this comment

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

quite important, as this indicates that null is a special case and does not have to mean the varabile is set to null?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see the need to highlight that: there is no difference between both situations if the variable can be set to null.

@@ -43,7 +43,7 @@ interface EventSubscriberInterface
* The code must not depend on runtime state as it will only be called at compile time.
* All logic depending on runtime state must be put into the individual methods handling the events.
*
* @return array<string, mixed> The event names to listen to
* @return array<string, mixed>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @return array<string, mixed>
* @return array<string, (string|list<string,int>|list<list<string,int>>)>

Copy link
Member Author

Choose a reason for hiding this comment

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

Added. but I'm wondering how useful such descriptions are. Looks quite cryptic.

Copy link
Member

Choose a reason for hiding this comment

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

It's by definition a win for static analysers to have the most precise type information possible. I agree that it's no longer that human readable (although it can be helpful as I always forget if it's ['eventName', prio] or the other way around)

@@ -1488,7 +1488,7 @@ public function isMethodIdempotent()
*
* @see https://tools.ietf.org/html/rfc7231#section-4.2.3
*
* @return bool True for GET and HEAD, false otherwise
Copy link
Member

Choose a reason for hiding this comment

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

quite useful information to know which methods are considered "cacheable" by this method? (should probably be added to the normal description)

Copy link
Member Author

@nicolas-grekas nicolas-grekas Aug 13, 2021

Choose a reason for hiding this comment

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

The other similar methods don't have it. The implementation should know what cacheable is, not the description.

src/Symfony/Component/Routing/Route.php Show resolved Hide resolved
src/Symfony/Contracts/Cache/CacheInterface.php Outdated Show resolved Hide resolved
src/Symfony/Contracts/Cache/TagAwareCacheInterface.php Outdated Show resolved Hide resolved
@Tobion
Copy link
Contributor

Tobion commented Aug 12, 2021

All the adding of return types in 6.0 like #42504 should probably be done after this one has been merged upwards.

@nicolas-grekas
Copy link
Member Author

Thanks for the reviews, PR updated accordingly.

All the adding of return types in 6.0 like #42504 should probably be done after this one has been merged upwards.

I'll deal with the conflicts. I prefer decoupling PRs.

@nicolas-grekas nicolas-grekas merged commit c91322d into symfony:5.4 Aug 17, 2021
@nicolas-grekas nicolas-grekas deleted the cleanup-return branch August 18, 2021 08:56
hultberg pushed a commit to hultberg/symfony that referenced this pull request Sep 17, 2021
…kas)

This PR was merged into the 5.4 branch.

Discussion
----------

Cleanup more ``@return`` annotations

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Follow up of symfony#42495, same motivation.
Automated edits, manual selection, happy review :P

Commits
-------

8f36bbd Cleanup more ``@return`` annotations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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