Skip to content

[DependencyInjection][HttpKernel] Add PHPDoc to attribute classes and properties #51971

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

Conversation

alexandre-daubois
Copy link
Member

@alexandre-daubois alexandre-daubois commented Oct 10, 2023

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets Part of #51920
License MIT

Friendly ping @GromNaN, is that what you had in mind? 🙂

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

Great work.

@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch 3 times, most recently from 1a2ff9b to 093bd61 Compare October 10, 2023 14:09
@OskarStark
Copy link
Contributor

@GromNaN is there any reason, why we don't use proper @param annotations?

@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch 2 times, most recently from 5807835 to 0b7bb65 Compare October 10, 2023 14:20
@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch from 0b7bb65 to fce3ee9 Compare October 10, 2023 15:43
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

LGTM after a few corrections to the types.

@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch from 5611f41 to 4b2f2b2 Compare October 18, 2023 09:16
@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch from 4b2f2b2 to 6d0a0ad Compare October 24, 2023 13:09
@GromNaN GromNaN added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Nov 1, 2023
@nicolas-grekas nicolas-grekas removed the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Nov 7, 2023
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
@@ -20,7 +20,14 @@
final class AsAlias
{
public function __construct(
Copy link
Contributor

Choose a reason for hiding this comment

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

@param should be used

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the whole PR 👍

@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch 3 times, most recently from e4a570b to 984e721 Compare December 30, 2023 16:48
nicolas-grekas added a commit that referenced this pull request Jan 2, 2024
…w] Add PHPDoc to attribute classes and properties (alexandre-daubois)

This PR was merged into the 7.1 branch.

Discussion
----------

[Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Part of #51920
| License       | MIT

One more round.

:information_source: A first review of this kind is being done [here](#51971), I'll adjust this PR accordingly once done 🙂

Commits
-------

8a2ac5a [Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties
symfony-splitter pushed a commit to symfony/event-dispatcher that referenced this pull request Jan 2, 2024
…w] Add PHPDoc to attribute classes and properties (alexandre-daubois)

This PR was merged into the 7.1 branch.

Discussion
----------

[Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Part of symfony/symfony#51920
| License       | MIT

One more round.

:information_source: A first review of this kind is being done [here](symfony/symfony#51971), I'll adjust this PR accordingly once done 🙂

Commits
-------

8a2ac5a6d2 [Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties
symfony-splitter pushed a commit to symfony/security-http that referenced this pull request Jan 2, 2024
…w] Add PHPDoc to attribute classes and properties (alexandre-daubois)

This PR was merged into the 7.1 branch.

Discussion
----------

[Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Part of symfony/symfony#51920
| License       | MIT

One more round.

:information_source: A first review of this kind is being done [here](symfony/symfony#51971), I'll adjust this PR accordingly once done 🙂

Commits
-------

8a2ac5a6d2 [Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties
symfony-splitter pushed a commit to symfony/workflow that referenced this pull request Jan 2, 2024
…w] Add PHPDoc to attribute classes and properties (alexandre-daubois)

This PR was merged into the 7.1 branch.

Discussion
----------

[Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Part of symfony/symfony#51920
| License       | MIT

One more round.

:information_source: A first review of this kind is being done [here](symfony/symfony#51971), I'll adjust this PR accordingly once done 🙂

Commits
-------

8a2ac5a6d2 [Console][EventDispatcher][Security][Serializer][Workflow] Add PHPDoc to attribute classes and properties
/**
* @param string $decorates The service id to decorate
* @param int $priority The priority of this decoration when multiple decorators are declared for the same service
* @param int $onInvalid The behavior to adopt when the decoration is invalid. Must be one of the {@see ContainerInterface} constants
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
* @param int $onInvalid The behavior to adopt when the decoration is invalid. Must be one of the {@see ContainerInterface} constants
* @param int $onInvalid The behavior to adopt when the decoration is invalid; must be one of the {@see ContainerInterface} constants

@@ -19,6 +19,10 @@
#[\Attribute(\Attribute::TARGET_CLASS)]
class AsTaggedItem
{
/**
* @param string|null $index The property or method to use to index the item in the locator
* @param int|null $priority The priority of the item. The higher the number, the earlier the tagged service will be located in the locator
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
* @param int|null $priority The priority of the item. The higher the number, the earlier the tagged service will be located in the locator
* @param int|null $priority The priority of the item; the higher the number, the earlier the tagged service will be located in the locator

@@ -11,6 +11,9 @@

namespace Symfony\Component\DependencyInjection\Attribute;

/**
* An attribute to autowire the inner object of decorating services.
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
* An attribute to autowire the inner object of decorating services.
* Autowires the inner object of decorating services.

@@ -13,9 +13,17 @@

use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* An attribute to declare a decorating service.
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
* An attribute to declare a decorating service.
* Declares a decorating service.

public ?string $name = null,
) {
/**
* @param string|null $name The service alias to autowire
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
* @param string|null $name The service alias to autowire
* @param string|null $name The name of the target autowiring alias

/**
* @param string|null $format The DateTime format to use, @see https://www.php.net/manual/en/datetime.format.php
* @param bool $disabled Whether this value resolver is disabled. This allows to enable a value resolver globally while disabling it in specific cases.
* @param class-string $resolver The class name of the resolver to use
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't have to be a FQCN, does it?

@@ -24,7 +24,11 @@ final class MapQueryParameter extends ValueResolver
/**
* @see https://php.net/filter.filters.validate for filter, flags and options
*
* @param string|null $name The name of the query parameter. If null, the name of the argument in the controller will be used.
* @param string|null $name The name of the query parameter. If null, the name of the argument in the controller will be used
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
* @param string|null $name The name of the query parameter. If null, the name of the argument in the controller will be used
* @param string|null $name The name of the query parameter; if null, the name of the argument in the controller will be used

#[\Attribute(\Attribute::TARGET_PARAMETER | \Attribute::IS_REPEATABLE)]
class ValueResolver
{
/**
* @param class-string<ValueResolverInterface>|string $resolver
* @param class-string<ValueResolverInterface>|string $resolver The class name of the resolver to use
* @param bool $disabled Whether this value resolver is disabled. This allows to enable a value resolver globally while disabling it in specific cases.
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
* @param bool $disabled Whether this value resolver is disabled. This allows to enable a value resolver globally while disabling it in specific cases.
* @param bool $disabled Whether this value resolver is disabled; this allows to enable a value resolver globally while disabling it in specific cases

@@ -12,16 +12,28 @@
namespace Symfony\Component\HttpKernel\Attribute;

/**
* An attribute to define the HTTP status code applied to an exception.
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
* An attribute to define the HTTP status code applied to an exception.
* Defines the HTTP status code applied to an exception.

@@ -14,13 +14,15 @@
use Psr\Log\LogLevel;

/**
* An attribute to define the log level applied to an exception.
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
* An attribute to define the log level applied to an exception.
* Defines the log level applied to an exception.

@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch from 984e721 to 7e2ae5a Compare January 2, 2024 13:07
@@ -24,7 +25,11 @@ final class MapQueryParameter extends ValueResolver
/**
* @see https://php.net/filter.filters.validate for filter, flags and options
*
* @param string|null $name The name of the query parameter. If null, the name of the argument in the controller will be used.
* @param string|null $name The name of the query parameter; if null, the name of the argument in the controller will be used
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
* @param string|null $name The name of the query parameter; if null, the name of the argument in the controller will be used
* @param string|null $name The name of the query parameter; if null, the name of the argument in the controller will be used

@@ -13,11 +13,15 @@

use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;

/**
* An attribute to tell which value resolver should be used for a given parameter.
Copy link
Member

Choose a reason for hiding this comment

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

Defines the value resolver to use for a given parameter.

* @param bool|null $autowire Whether to declare the service as autowired
* @param array<string, mixed>|null $properties The properties to define when creating the service
* @param array<class-string, string>|string|null $configurator A PHP function, reference or an array containing a class/Reference and a method to call after the service is fully initialized
* @param string|null $constructor The public static inner method to use to instantiate the service
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
* @param string|null $constructor The public static inner method to use to instantiate the service
* @param string|null $constructor The public static method to use to instantiate the service

@alexandre-daubois alexandre-daubois force-pushed the attribues-docs-di-httpkernel branch 2 times, most recently from 0f2a4c0 to 0c171b5 Compare January 2, 2024 13:16
@alexandre-daubois
Copy link
Member Author

alexandre-daubois commented Jan 2, 2024

Fabbot's having (and giving) hard times with some of the advanced types 😅 Addressed remaining comments, thanks

@nicolas-grekas nicolas-grekas force-pushed the attribues-docs-di-httpkernel branch from 0c171b5 to a9030f1 Compare January 2, 2024 13:18
@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

@nicolas-grekas nicolas-grekas merged commit b990b26 into symfony:7.1 Jan 2, 2024
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