Skip to content

Commit 708e39f

Browse files
[FrameworkBundle][RemoteEvent][Routing][Scheduler] Add PHPDoc to attributes properties
1 parent f3a09b9 commit 708e39f

File tree

6 files changed

+131
-3
lines changed

6 files changed

+131
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Routing/Attribute/AsRoutingConditionService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
#[\Attribute(\Attribute::TARGET_CLASS)]
4242
class AsRoutingConditionService extends AutoconfigureTag
4343
{
44+
/**
45+
* @param string|null $alias The alias of the service to use it in routing condition expressions
46+
* @param int $priority The priority of the service when gathered in a service iterator or locator
47+
*/
4448
public function __construct(
4549
string $alias = null,
4650
int $priority = 0,

src/Symfony/Component/RemoteEvent/Attribute/AsRemoteEventConsumer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
class AsRemoteEventConsumer
1919
{
2020
public function __construct(
21+
/**
22+
* The name of the remote event consumer, used to identify it when defining remote events.
23+
*/
2124
public string $name,
2225
) {
2326
}

src/Symfony/Component/Routing/Annotation/Route.php

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* Annotation class for @Route().
1616
*
1717
* @Annotation
18+
*
1819
* @NamedArgumentConstructor
20+
*
1921
* @Target({"CLASS", "METHOD"})
2022
*
2123
* @author Fabien Potencier <fabien@symfony.com>
@@ -30,25 +32,67 @@ class Route
3032
private array $schemes;
3133

3234
/**
33-
* @param array<string|\Stringable> $requirements
34-
* @param string[]|string $methods
35-
* @param string[]|string $schemes
35+
* @param string|array<string,string>|null $path The route path (i.e. "/user/login")
36+
* @param string|string[] $methods The list of HTTP methods allowed by this route
37+
* @param string|string[] $schemes The list of schemes allowed by this route (i.e. "https")
38+
* @param string|null $locale The locale accepted by the route
39+
* @param string|null $format The format returned by the route (i.e. "json", "xml")
40+
* @param bool|null $utf8 Whether the route accepts UTF-8 in its parameters
41+
* @param bool|null $stateless Whether the route is defined as stateless or stateful, @see https://symfony.com/doc/current/routing.html#stateless-routes
3642
*/
3743
public function __construct(
3844
string|array $path = null,
45+
46+
/**
47+
* The route name (i.e. "app_user_login").
48+
*/
3949
private ?string $name = null,
50+
51+
/**
52+
* Requirements for the route
53+
* attributes (@see https://symfony.com/doc/current/routing.html#parameters-validation).
54+
*
55+
* @var array<string|\Stringable>
56+
*/
4057
private array $requirements = [],
58+
59+
/**
60+
* Other route configuration like its prefix (i.e. ['prefix' => '/api']).
61+
*/
4162
private array $options = [],
63+
64+
/**
65+
* The default values for the route attributes and
66+
* query parameters.
67+
*/
4268
private array $defaults = [],
69+
70+
/**
71+
* A host for which the route will be matched.
72+
*/
4373
private ?string $host = null,
4474
array|string $methods = [],
4575
array|string $schemes = [],
76+
77+
/**
78+
* An expression that must evaluate to true for the route
79+
* to be matched (@see https://symfony.com/doc/current/routing.html#matching-expressions).
80+
*/
4681
private ?string $condition = null,
82+
83+
/**
84+
* The evaluation priority of the route if multiple are
85+
* defined with the same path.
86+
*/
4787
private ?int $priority = null,
4888
string $locale = null,
4989
string $format = null,
5090
bool $utf8 = null,
5191
bool $stateless = null,
92+
93+
/**
94+
* The env in which the route is defined (i.e. "dev", "test", "prod").
95+
*/
5296
private ?string $env = null
5397
) {
5498
if (\is_array($path)) {

src/Symfony/Component/Scheduler/Attribute/AsCronTask.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,47 @@
2020
class AsCronTask
2121
{
2222
public function __construct(
23+
/**
24+
* The cron expression to define the task schedule (i.e. "5 * * * *").
25+
*/
2326
public readonly string $expression,
27+
28+
/**
29+
* The timezone used with the cron expression.
30+
*/
2431
public readonly ?string $timezone = null,
32+
33+
/**
34+
* The cron jitter, in seconds. For example, if set to 60, the cron
35+
* will randomly wait for a number of seconds between 0 and 60 before
36+
* executing. This allows to avoid load spikes that can happen when many tasks
37+
* run at the same time.
38+
*/
2539
public readonly ?int $jitter = null,
40+
41+
/**
42+
* The arguments to pass to the cron task.
43+
*
44+
* @var array<array-key, mixed>|string|null
45+
*/
2646
public readonly array|string|null $arguments = null,
47+
48+
/**
49+
* The name of the schedule responsible for triggering the task.
50+
*/
2751
public readonly string $schedule = 'default',
52+
53+
/**
54+
* The method to run as the task when the attribute target is a class.
55+
*/
2856
public readonly ?string $method = null,
57+
58+
/**
59+
* One or many transports through which the message scheduling
60+
* the task will go.
61+
*
62+
* @var string[]|string|null
63+
*/
2964
public readonly array|string|null $transports = null,
3065
) {
3166
}

src/Symfony/Component/Scheduler/Attribute/AsPeriodicTask.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,52 @@
2020
class AsPeriodicTask
2121
{
2222
public function __construct(
23+
/**
24+
* A string or an integer representing the frequency of the task (i.e. "every hour").
25+
*/
2326
public readonly string|int $frequency,
27+
28+
/**
29+
* A string representing the start time of the periodic task (i.e. "08:00:00").
30+
*/
2431
public readonly ?string $from = null,
32+
33+
/**
34+
* A string representing the end time of the periodic task (i.e. "20:00:00").
35+
*/
2536
public readonly ?string $until = null,
37+
38+
/**
39+
* The cron jitter, in seconds. For example, if set to 60, the cron
40+
* will randomly wait for a number of seconds between 0 and 60 before
41+
* executing. This allows to avoid load spikes that can happen when many tasks
42+
* run at the same time.
43+
*/
2644
public readonly ?int $jitter = null,
45+
46+
/**
47+
* The arguments to pass to the cron task.
48+
*
49+
* @var array<array-key, mixed>|string|null
50+
*/
2751
public readonly array|string|null $arguments = null,
52+
53+
/**
54+
* The name of the schedule responsible for triggering the task.
55+
*/
2856
public readonly string $schedule = 'default',
57+
58+
/**
59+
* The method to run as the task when the attribute target is a class.
60+
*/
2961
public readonly ?string $method = null,
62+
63+
/**
64+
* One or many transports through which the message scheduling
65+
* the task will go.
66+
*
67+
* @var string[]|string|null
68+
*/
3069
public readonly array|string|null $transports = null,
3170
) {
3271
}

src/Symfony/Component/Scheduler/Attribute/AsSchedule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
class AsSchedule
2121
{
2222
public function __construct(
23+
/**
24+
* The name of the schedule that will be used when creating tasks.
25+
*/
2326
public string $name = 'default',
2427
) {
2528
}

0 commit comments

Comments
 (0)