Skip to content

Commit d948312

Browse files
minor #41928 [DependencyInjection] Add types to private properties (derrabus)
This PR was merged into the 6.0 branch. Discussion ---------- [DependencyInjection] Add types to private properties | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Same procedure as #41924, but on a more complex component. Commits ------- 069da20 [DependencyInjection] Add types to private properties
2 parents f111c94 + 069da20 commit d948312

File tree

76 files changed

+297
-400
lines changed

Some content is hidden

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

76 files changed

+297
-400
lines changed

src/Symfony/Component/DependencyInjection/Alias.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class Alias
1717
{
1818
private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.';
1919

20-
private $id;
21-
private $public;
22-
private $deprecation = [];
20+
private string $id;
21+
private bool $public;
22+
private array $deprecation = [];
2323

2424
public function __construct(string $id, bool $public = false)
2525
{

src/Symfony/Component/DependencyInjection/Argument/AbstractArgument.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
final class AbstractArgument
1818
{
19-
private $text;
20-
private $context;
19+
private string $text;
20+
private string $context = '';
2121

2222
public function __construct(string $text = '')
2323
{

src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ final class BoundArgument implements ArgumentInterface
2020
public const DEFAULTS_BINDING = 1;
2121
public const INSTANCEOF_BINDING = 2;
2222

23-
private static $sequence = 0;
23+
private static int $sequence = 0;
2424

25-
private $value;
26-
private $identifier;
27-
private $used;
28-
private $type;
29-
private $file;
25+
private mixed $value;
26+
private ?int $identifier = null;
27+
private ?bool $used = null;
28+
private int $type;
29+
private ?string $file;
3030

3131
public function __construct(mixed $value, bool $trackUsage = true, int $type = 0, string $file = null)
3232
{

src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
trait ReferenceSetArgumentTrait
2222
{
23-
private $values;
23+
private array $values;
2424

2525
/**
2626
* @param Reference[] $values

src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
*/
1717
class RewindableGenerator implements \IteratorAggregate, \Countable
1818
{
19-
private $generator;
20-
private $count;
19+
private \Closure $generator;
20+
private \Closure|int $count;
2121

2222
public function __construct(callable $generator, int|callable $count)
2323
{
24-
$this->generator = $generator;
25-
$this->count = $count;
24+
$this->generator = $generator instanceof \Closure ? $generator : \Closure::fromCallable($generator);
25+
$this->count = is_callable($count) && !$count instanceof \Closure ? \Closure::fromCallable($count) : $count;
2626
}
2727

2828
public function getIterator(): \Traversable

src/Symfony/Component/DependencyInjection/Argument/ServiceClosureArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class ServiceClosureArgument implements ArgumentInterface
2323
{
24-
private $values;
24+
private array $values;
2525

2626
public function __construct(Reference $reference)
2727
{

src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*/
2121
class ServiceLocator extends BaseServiceLocator
2222
{
23-
private $factory;
24-
private $serviceMap;
25-
private $serviceTypes;
23+
private \Closure $factory;
24+
private array $serviceMap;
25+
private ?array $serviceTypes;
2626

2727
public function __construct(\Closure $factory, array $serviceMap, array $serviceTypes = null)
2828
{

src/Symfony/Component/DependencyInjection/Argument/ServiceLocatorArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ServiceLocatorArgument implements ArgumentInterface
2222
{
2323
use ReferenceSetArgumentTrait;
2424

25-
private $taggedIteratorArgument;
25+
private ?TaggedIteratorArgument $taggedIteratorArgument = null;
2626

2727
/**
2828
* @param Reference[]|TaggedIteratorArgument $values

src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
*/
1919
class TaggedIteratorArgument extends IteratorArgument
2020
{
21-
private $tag;
22-
private $indexAttribute;
23-
private $defaultIndexMethod;
24-
private $defaultPriorityMethod;
25-
private $needsIndexes = false;
21+
private string $tag;
22+
private mixed $indexAttribute;
23+
private ?string $defaultIndexMethod;
24+
private ?string $defaultPriorityMethod;
25+
private bool $needsIndexes;
2626

2727
/**
2828
* @param string $tag The name of the tag identifying the target services

src/Symfony/Component/DependencyInjection/ChildDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class ChildDefinition extends Definition
2323
{
24-
private $parent;
24+
private string $parent;
2525

2626
/**
2727
* @param string $parent The id of Definition instance to decorate

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy