Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 80e6e41

Browse files
minor #51974 [Console][EventDispatcher][Security][Serializer][Workflow] 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
2 parents 447dd26 + b77aec4 commit 80e6e41

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

Attribute/CurrentUser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#[\Attribute(\Attribute::TARGET_PARAMETER)]
2121
class CurrentUser extends ValueResolver
2222
{
23+
/**
24+
* @param bool $disabled Whether this value resolver is disabled, which allows to enable a value resolver globally while disabling it in specific cases
25+
* @param string $resolver The class name of the resolver to use
26+
*/
2327
public function __construct(bool $disabled = false, string $resolver = UserValueResolver::class)
2428
{
2529
parent::__construct($resolver, $disabled);

Attribute/IsGranted.php

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,27 @@
1414
use Symfony\Component\ExpressionLanguage\Expression;
1515

1616
/**
17+
* Checks if user has permission to access to some resource using security roles and voters.
18+
*
19+
* @see https://symfony.com/doc/current/security.html#roles
20+
*
1721
* @author Ryan Weaver <[email protected]>
1822
*/
1923
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)]
2024
final class IsGranted
2125
{
26+
/**
27+
* @param string|Expression $attribute The attribute that will be checked against a given authentication token and optional subject
28+
* @param array|string|Expression|null $subject An optional subject - e.g. the current object being voted on
29+
* @param string|null $message A custom message when access is not granted
30+
* @param int|null $statusCode If set, will throw HttpKernel's HttpException with the given $statusCode; if null, Security\Core's AccessDeniedException will be used
31+
* @param int|null $exceptionCode If set, will add the exception code to thrown exception
32+
*/
2233
public function __construct(
23-
/**
24-
* Sets the first argument that will be passed to isGranted().
25-
*/
2634
public string|Expression $attribute,
27-
28-
/**
29-
* Sets the second argument passed to isGranted().
30-
*
31-
* @var array<string|Expression>|string|Expression|null
32-
*/
3335
public array|string|Expression|null $subject = null,
34-
35-
/**
36-
* The message of the exception - has a nice default if not set.
37-
*/
3836
public ?string $message = null,
39-
40-
/**
41-
* If set, will throw HttpKernel's HttpException with the given $statusCode.
42-
* If null, Security\Core's AccessDeniedException will be used.
43-
*/
4437
public ?int $statusCode = null,
45-
46-
/**
47-
* If set, will add the exception code to thrown exception.
48-
*/
4938
public ?int $exceptionCode = null,
5039
) {
5140
}

0 commit comments

Comments
 (0)