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

+16-6
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

+2-2
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

+5-11
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

+1-1
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

+1-1
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

+1-4
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

+1-4
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

+9-9
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

+1-1
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

+1-4
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): ?ContainerInterface

src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
*/
2828
class HttpCache extends BaseHttpCache
2929
{
30-
protected $cacheDir;
31-
protected $kernel;
30+
protected ?string $cacheDir = null;
31+
protected KernelInterface $kernel;
3232

3333
private ?StoreInterface $store = null;
3434
private ?SurrogateInterface $surrogate;

src/Symfony/Bundle/FrameworkBundle/Secrets/AbstractVault.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
abstract class AbstractVault
1818
{
19-
protected $lastMessage;
19+
protected ?string $lastMessage = null;
2020

2121
public function getLastMessage(): ?string
2222
{

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,9 @@ abstract class KernelTestCase extends TestCase
2727
use MailerAssertionsTrait;
2828
use NotificationAssertionsTrait;
2929

30-
protected static $class;
31-
32-
/**
33-
* @var KernelInterface
34-
*/
35-
protected static $kernel;
36-
37-
protected static $booted = false;
30+
protected static ?string $class = null;
31+
protected static ?KernelInterface $kernel = null;
32+
protected static bool $booted = false;
3833

3934
protected function tearDown(): void
4035
{

src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
*/
2525
class Translator extends BaseTranslator implements WarmableInterface
2626
{
27-
protected $container;
28-
protected $loaderIds;
29-
30-
protected $options = [
27+
protected ContainerInterface $container;
28+
protected array $loaderIds;
29+
protected array $options = [
3130
'cache_dir' => null,
3231
'debug' => false,
3332
'resource_files' => [],

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@
2525
*/
2626
abstract class AbstractFactory implements AuthenticatorFactoryInterface
2727
{
28-
protected $options = [
28+
protected array $options = [
2929
'check_path' => '/login_check',
3030
'use_forward' => false,
3131
'require_previous_session' => false,
3232
'login_path' => '/login',
3333
];
3434

35-
protected $defaultSuccessHandlerOptions = [
35+
protected array $defaultSuccessHandlerOptions = [
3636
'always_use_default_target_path' => false,
3737
'default_target_path' => '/',
3838
'login_path' => '/login',
3939
'target_path_parameter' => '_target_path',
4040
'use_referer' => false,
4141
];
4242

43-
protected $defaultFailureHandlerOptions = [
43+
protected array $defaultFailureHandlerOptions = [
4444
'failure_path' => null,
4545
'failure_forward' => false,
4646
'login_path' => '/login',

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RememberMeFactory implements AuthenticatorFactoryInterface, PrependExtensi
3232
{
3333
public const PRIORITY = -50;
3434

35-
protected $options = [
35+
protected array $options = [
3636
'name' => 'REMEMBERME',
3737
'lifetime' => 31536000,
3838
'path' => '/',

src/Symfony/Component/BrowserKit/AbstractBrowser.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@
3232
*/
3333
abstract class AbstractBrowser
3434
{
35-
protected $history;
36-
protected $cookieJar;
37-
protected $server = [];
38-
protected $internalRequest;
39-
protected $request;
40-
protected $internalResponse;
41-
protected $response;
42-
protected $crawler;
35+
protected History $history;
36+
protected CookieJar $cookieJar;
37+
protected array $server = [];
38+
protected Request $internalRequest;
39+
protected object $request;
40+
protected Response $internalResponse;
41+
protected object $response;
42+
protected Crawler $crawler;
4343
protected bool $useHtml5Parser = true;
44-
protected $insulated = false;
45-
protected $redirect;
46-
protected $followRedirects = true;
47-
protected $followMetaRefresh = false;
44+
protected bool $insulated = false;
45+
protected ?string $redirect;
46+
protected bool $followRedirects = true;
47+
protected bool $followMetaRefresh = false;
4848

4949
private int $maxRedirects = -1;
5050
private int $redirectCount = 0;

src/Symfony/Component/BrowserKit/Cookie.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class Cookie
3535
'D M d H:i:s Y T',
3636
];
3737

38-
protected $name;
39-
protected $value;
40-
protected $expires;
41-
protected $path;
42-
protected $domain;
43-
protected $secure;
44-
protected $httponly;
45-
protected $rawValue;
38+
protected string $name;
39+
protected string $value;
40+
protected ?string $expires = null;
41+
protected string $path;
42+
protected string $domain;
43+
protected bool $secure;
44+
protected bool $httponly;
45+
protected string $rawValue;
4646
private ?string $samesite;
4747

4848
/**

src/Symfony/Component/BrowserKit/CookieJar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class CookieJar
2222
{
23-
protected $cookieJar = [];
23+
protected array $cookieJar = [];
2424

2525
public function set(Cookie $cookie): void
2626
{

src/Symfony/Component/BrowserKit/History.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*/
2121
class History
2222
{
23-
protected $stack = [];
24-
protected $position = -1;
23+
protected array $stack = [];
24+
protected int $position = -1;
2525

2626
/**
2727
* Clears the history.

0 commit comments

Comments
 (0)
0