Skip to content

Commit c41ea2d

Browse files
OskarStarknicolas-grekas
authored andcommitted
[Config] Use CPP
1 parent b9c61b6 commit c41ea2d

19 files changed

+69
-102
lines changed

src/Symfony/Component/Config/Builder/ClassBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
class ClassBuilder
2222
{
23-
private string $namespace;
2423
private string $name;
2524

2625
/** @var Property[] */
@@ -33,9 +32,10 @@ class ClassBuilder
3332
private array $implements = [];
3433
private bool $allowExtraKeys = false;
3534

36-
public function __construct(string $namespace, string $name)
37-
{
38-
$this->namespace = $namespace;
35+
public function __construct(
36+
private string $namespace,
37+
string $name,
38+
) {
3939
$this->name = ucfirst($this->camelCase($name)).'Config';
4040
}
4141

src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ class ConfigBuilderGenerator implements ConfigBuilderGeneratorInterface
3737
* @var ClassBuilder[]
3838
*/
3939
private array $classes = [];
40-
private string $outputDir;
4140

42-
public function __construct(string $outputDir)
43-
{
44-
$this->outputDir = $outputDir;
41+
public function __construct(
42+
private string $outputDir,
43+
) {
4544
}
4645

4746
/**

src/Symfony/Component/Config/Builder/Method.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
*/
2121
class Method
2222
{
23-
private string $content;
24-
25-
public function __construct(string $content)
26-
{
27-
$this->content = $content;
23+
public function __construct(
24+
private string $content,
25+
) {
2826
}
2927

3028
public function getContent(): string

src/Symfony/Component/Config/Builder/Property.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@
2020
*/
2121
class Property
2222
{
23-
private string $name;
24-
private string $originalName;
2523
private bool $array = false;
2624
private bool $scalarsAllowed = false;
2725
private ?string $type = null;
2826
private ?string $content = null;
2927

30-
public function __construct(string $originalName, string $name)
31-
{
32-
$this->name = $name;
33-
$this->originalName = $originalName;
28+
public function __construct(
29+
private string $originalName,
30+
private string $name,
31+
) {
3432
}
3533

3634
public function getName(): string

src/Symfony/Component/Config/ConfigCache.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@
2525
*/
2626
class ConfigCache extends ResourceCheckerConfigCache
2727
{
28-
private bool $debug;
29-
3028
/**
3129
* @param string $file The absolute cache path
3230
* @param bool $debug Whether debugging is enabled or not
3331
*/
34-
public function __construct(string $file, bool $debug)
35-
{
36-
$this->debug = $debug;
37-
32+
public function __construct(
33+
string $file,
34+
private bool $debug,
35+
) {
3836
$checkers = [];
3937
if (true === $this->debug) {
4038
$checkers = [new SelfCheckingResourceChecker()];

src/Symfony/Component/Config/ConfigCacheFactory.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
*/
2323
class ConfigCacheFactory implements ConfigCacheFactoryInterface
2424
{
25-
private bool $debug;
26-
2725
/**
2826
* @param bool $debug The debug flag to pass to ConfigCache
2927
*/
30-
public function __construct(bool $debug)
31-
{
32-
$this->debug = $debug;
28+
public function __construct(
29+
private bool $debug,
30+
) {
3331
}
3432

3533
public function cache(string $file, callable $callback): ConfigCacheInterface

src/Symfony/Component/Config/Definition/BaseNode.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ abstract class BaseNode implements NodeInterface
3030
private static array $placeholders = [];
3131

3232
protected string $name;
33-
protected ?NodeInterface $parent;
3433
protected array $normalizationClosures = [];
3534
protected array $normalizedTypes = [];
3635
protected array $finalValidationClosures = [];
@@ -39,22 +38,22 @@ abstract class BaseNode implements NodeInterface
3938
protected array $deprecation = [];
4039
protected array $equivalentValues = [];
4140
protected array $attributes = [];
42-
protected string $pathSeparator;
4341

4442
private mixed $handlingPlaceholder = null;
4543

4644
/**
4745
* @throws \InvalidArgumentException if the name contains a period
4846
*/
49-
public function __construct(?string $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
50-
{
47+
public function __construct(
48+
?string $name,
49+
protected ?NodeInterface $parent = null,
50+
protected string $pathSeparator = self::DEFAULT_PATH_SEPARATOR,
51+
) {
5152
if (str_contains($name = (string) $name, $pathSeparator)) {
5253
throw new \InvalidArgumentException('The name must not contain ".'.$pathSeparator.'".');
5354
}
5455

5556
$this->name = $name;
56-
$this->parent = $parent;
57-
$this->pathSeparator = $pathSeparator;
5857
}
5958

6059
/**

src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ class ExprBuilder
3030
public ?\Closure $ifPart = null;
3131
public ?\Closure $thenPart = null;
3232

33-
protected NodeDefinition $node;
34-
35-
public function __construct(NodeDefinition $node)
36-
{
37-
$this->node = $node;
33+
public function __construct(
34+
protected NodeDefinition $node,
35+
) {
3836
}
3937

4038
/**

src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ class MergeBuilder
2121
public bool $allowFalse = false;
2222
public bool $allowOverwrite = true;
2323

24-
protected NodeDefinition $node;
25-
26-
public function __construct(NodeDefinition $node)
27-
{
28-
$this->node = $node;
24+
public function __construct(
25+
protected NodeDefinition $node,
26+
) {
2927
}
3028

3129
/**

src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class NormalizationBuilder
2222
public array $declaredTypes = [];
2323
public array $remappings = [];
2424

25-
protected NodeDefinition $node;
26-
27-
public function __construct(NodeDefinition $node)
28-
{
29-
$this->node = $node;
25+
public function __construct(
26+
protected NodeDefinition $node,
27+
) {
3028
}
3129

3230
/**

0 commit comments

Comments
 (0)