Skip to content

Commit a0e2da9

Browse files
squriousOskarStark
authored andcommitted
[DoctrineBridge][TwigBridge] Add PHPDoc to attributes
1 parent 366baef commit a0e2da9

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

src/Symfony/Bridge/Doctrine/Attribute/MapEntity.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,61 @@
2121
class MapEntity extends ValueResolver
2222
{
2323
public function __construct(
24+
/**
25+
* The entity class.
26+
*
27+
* @var class-string|null
28+
*/
2429
public ?string $class = null,
30+
31+
/**
32+
* Specify the object manager used to retrieve the entity.
33+
*/
2534
public ?string $objectManager = null,
35+
36+
/**
37+
* An expression to fetch the entity using the ExpressionLanguage syntax.
38+
*
39+
* The following variables are available:
40+
* - `repository` will be your entity repository.
41+
* - Any request attributes are available as variables.
42+
*
43+
* @see https://symfony.com/doc/current/components/expression_language.html
44+
*/
2645
public ?string $expr = null,
46+
47+
/**
48+
* Configures the properties and values to use with the findOneBy() method.
49+
* The key is the route placeholder name and the value is the Doctrine property name.
50+
*
51+
* @var array<string, string>|null
52+
*/
2753
public ?array $mapping = null,
54+
55+
/**
56+
* Configures the properties that should be used in the findOneBy() method by excluding
57+
* one or more properties so that not all are used.
58+
*
59+
* @var string[]|null
60+
*/
2861
public ?array $exclude = null,
62+
63+
/**
64+
* Whether to prevent null values from being used as parameters in the query.
65+
*/
2966
public ?bool $stripNull = null,
67+
68+
/**
69+
* If an id option is configured and matches a route parameter, then the resolver will
70+
* find by the primary key.
71+
*
72+
* @var string[]|string|null
73+
*/
3074
public array|string|null $id = null,
75+
76+
/**
77+
* If true, forces Doctrine to always fetch the entity from the database instead of cache.
78+
*/
3179
public ?bool $evictCache = null,
3280
bool $disabled = false,
3381
string $resolver = EntityValueResolver::class,

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ class UniqueEntity extends Constraint
3737
public bool|array|string $ignoreNull = true;
3838

3939
/**
40-
* @param array|string $fields The combination of fields that must contain unique values or a set of options
41-
* @param bool|array|string $ignoreNull The combination of fields that ignore null values
40+
* @param array|string $fields The combination of fields that must contain unique values or a set of options
41+
* @param bool|string[]|string $ignoreNull The combination of fields that ignore null values
42+
* @param string|null $em The entity manager used to query for uniqueness instead of the manager of this class
43+
* @param string|null $entityClass The entity class to enforce uniqueness on instead of the current class
44+
* @param string|null $repositoryMethod The repository method to check uniqueness instead of findBy. The method will receive as its argument
45+
* a fieldName => value associative array according to the fields option configuration
46+
* @param string|null $errorPath Bind the constraint violation to this field instead of the first one in the fields option configuration
4247
*/
4348
public function __construct(
4449
array|string $fields,

src/Symfony/Bridge/Twig/Attribute/Template.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Bridge\Twig\Attribute;
1313

14+
/**
15+
* Define the template to render in the controller.
16+
*/
1417
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)]
1518
class Template
1619
{
@@ -22,6 +25,8 @@ public function __construct(
2225

2326
/**
2427
* The controller method arguments to pass to the template.
28+
*
29+
* @var string[]|null
2530
*/
2631
public ?array $vars = null,
2732

0 commit comments

Comments
 (0)