Skip to content

Commit dcd0d7a

Browse files
Add types to public and protected properties
1 parent 2c3bcc6 commit dcd0d7a

File tree

8 files changed

+21
-33
lines changed

8 files changed

+21
-33
lines changed

DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ abstract class AbstractDoctrineExtension extends Extension
2828
/**
2929
* Used inside metadata driver method to simplify aggregation of data.
3030
*/
31-
protected $aliasMap = [];
31+
protected array $aliasMap = [];
3232

3333
/**
3434
* Used inside metadata driver method to simplify aggregation of data.
3535
*/
36-
protected $drivers = [];
36+
protected array $drivers = [];
3737

3838
/**
3939
* @param array $objectManager A configured object manager

DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,15 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
3535
/**
3636
* DI object for the driver to use, either a service definition for a
3737
* private service or a reference for a public service.
38-
*
39-
* @var Definition|Reference
4038
*/
41-
protected $driver;
39+
protected Definition|Reference $driver;
4240

4341
/**
4442
* List of namespaces handled by the driver.
4543
*
4644
* @var string[]
4745
*/
48-
protected $namespaces;
46+
protected array $namespaces;
4947

5048
/**
5149
* List of potential container parameters that hold the object manager name
@@ -54,24 +52,20 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
5452
*
5553
* @var string[]
5654
*/
57-
protected $managerParameters;
55+
protected array $managerParameters;
5856

5957
/**
6058
* Naming pattern of the metadata chain driver service ids, for example
6159
* 'doctrine.orm.%s_metadata_driver'.
62-
*
63-
* @var string
6460
*/
65-
protected $driverPattern;
61+
protected string $driverPattern;
6662

6763
/**
6864
* A name for a parameter in the container. If set, this compiler pass will
6965
* only do anything if the parameter is present. (But regardless of the
7066
* value of that parameter.
71-
*
72-
* @var string|false
7367
*/
74-
protected $enabledParameter;
68+
protected string|false $enabledParameter;
7569

7670
/**
7771
* Naming pattern for the configuration service id, for example

Form/DoctrineOrmExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class DoctrineOrmExtension extends AbstractExtension
2020
{
21-
protected $registry;
21+
protected ManagerRegistry $registry;
2222

2323
public function __construct(ManagerRegistry $registry)
2424
{

Form/DoctrineOrmTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
3838
{
39-
protected $registry;
39+
protected ManagerRegistry $registry;
4040

4141
private array $cache = [];
4242

Form/Type/DoctrineType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131

3232
abstract class DoctrineType extends AbstractType implements ResetInterface
3333
{
34-
/**
35-
* @var ManagerRegistry
36-
*/
37-
protected $registry;
34+
protected ManagerRegistry $registry;
3835

3936
/**
4037
* @var IdReader[]

ManagerRegistry.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
*/
2525
abstract class ManagerRegistry extends AbstractManagerRegistry
2626
{
27-
/**
28-
* @var Container
29-
*/
30-
protected $container;
27+
protected Container $container;
3128

3229
protected function getService($name): object
3330
{

Validator/Constraints/UniqueEntity.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ class UniqueEntity extends Constraint
2727
self::NOT_UNIQUE_ERROR => 'NOT_UNIQUE_ERROR',
2828
];
2929

30-
public $message = 'This value is already used.';
31-
public $service = 'doctrine.orm.validator.unique';
32-
public $em;
33-
public $entityClass;
34-
public $repositoryMethod = 'findBy';
35-
public $fields = [];
36-
public $errorPath;
37-
public $ignoreNull = true;
30+
public string $message = 'This value is already used.';
31+
public string $service = 'doctrine.orm.validator.unique';
32+
public ?string $em = null;
33+
public ?string $entityClass = null;
34+
public string $repositoryMethod = 'findBy';
35+
public array|string $fields = [];
36+
public ?string $errorPath = null;
37+
public bool|array|string $ignoreNull = true;
3838

3939
/**
4040
* @param array|string $fields The combination of fields that must contain unique values or a set of options
4141
* @param bool|array|string $ignoreNull The combination of fields that ignore null values
4242
*/
4343
public function __construct(
44-
$fields,
44+
array|string $fields,
4545
string $message = null,
4646
string $service = null,
4747
string $em = null,

Validator/DoctrineInitializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class DoctrineInitializer implements ObjectInitializerInterface
2323
{
24-
protected $registry;
24+
protected ManagerRegistry $registry;
2525

2626
public function __construct(ManagerRegistry $registry)
2727
{

0 commit comments

Comments
 (0)