8000 Add types to public and protected properties · symfony/symfony@a500eb6 · GitHub
[go: up one dir, main page]

Skip to content

Commit a500eb6

Browse files
Add types to public and protected properties
1 parent 6f6f35a commit a500eb6

File tree

276 files changed

+829
-1241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+829
-1241
lines changed

.github/expected-missing-return-types.diff

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/
4545
+ protected function filterResponse(object $response): Response
4646
{
4747
return $response;
48+
diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
49+
--- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
50+
+++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
51+
@@ -94,5 +94,5 @@ abstract class NodeDefinition implements NodeParentInterface
52+
* @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition
53+
*/
54+
- public function end(): NodeParentInterface
55+
+ public function end(): NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition
56+
{
57+
return $this->parent;
4858
diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php
4959
--- a/src/Symfony/Component/Console/Command/Command.php
5060
+++ b/src/Symfony/Component/Console/Command/Command.php
@@ -72,14 +82,14 @@ diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Com
7282
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php
7383
--- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php
7484
+++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php
75-
@@ -41,5 +41,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface
85+
@@ -38,5 +38,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface
7686
* @return void
7787
*/
7888
- public function process(ContainerBuilder $container)
7989
+ public function process(ContainerBuilder $container): void
8090
{
8191
$this->container = $container;
82-
@@ -72,5 +72,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface
92+
@@ -69,5 +69,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface
8393
* @return mixed
8494
*/
8595
- protected function processValue(mixed $value, bool $isRoot = false)
@@ -278,28 +288,28 @@ diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Comp
278288
diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php
279289
--- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php
280290
+++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php
281-
@@ -38,5 +38,5 @@ abstract class Bundle implements BundleInterface
291+
@@ -35,5 +35,5 @@ abstract class Bundle implements BundleInterface
282292
* @return void
283293
*/
284294
- public function boot()
285295
+ public function boot(): void
286296
{
287297
}
288-
@@ -45,5 +45,5 @@ abstract class Bundle implements BundleInterface
298+
@@ -42,5 +42,5 @@ abstract class Bundle implements BundleInterface
289299
* @return void
290300
*/
291301
- public function shutdown()
292302
+ public function shutdown(): void
293303
{
294304
}
295-
@@ -55,5 +55,5 @@ abstract class Bundle implements BundleInterface
305+
@@ -52,5 +52,5 @@ abstract class Bundle implements BundleInterface
296306
* @return void
297307
*/
298308
- public function build(ContainerBuilder $container)
299309
+ public function build(ContainerBuilder $container): void
300310
{
301311
}
302-
@@ -125,5 +125,5 @@ abstract class Bundle implements BundleInterface
312+
@@ -122,5 +122,5 @@ abstract class Bundle implements BundleInterface
303313
* @return void
304314
*/
305315
- public function registerCommands(Application $application)

src/Symfony/Bridge/Doctrine/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

src/Symfony/Bridge/Doctrine/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

src/Symfony/Bridge/Doctrine/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
{

src/Symfony/Bridge/Doctrine/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

src/Symfony/Bridge/Doctrine/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[]

src/Symfony/Bridge/Doctrine/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
{

src/Symfony/Bridge/Doctrine/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,

src/Symfony/Bridge/Doctrine/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
{

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@
5555
*/
5656
abstract class AbstractController implements ServiceSubscriberInterface
5757
{
58-
/**
59-
* @var ContainerInterface
60-
*/
61-
protected $container;
58+
protected ContainerInterface $container;
6259

6360
#[Required]
6461
public function setContainer(ContainerInterface $container): ?ContainerInter 375E face

0 commit comments

Comments
 (0)
0