8000 More cleanup · symfony/symfony@a9a1735 · GitHub
[go: up one dir, main page]

Skip to content

Commit a9a1735

Browse files
committed
More cleanup
1 parent 4e5f53a commit a9a1735

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(string $namespace, string $name)
4343

4444
public function getFilePath(): string
4545
{
46-
return str_replace('\\', \DIRECTORY_SEPARATOR, $this->getNamespace());
46+
return str_replace('\\', \DIRECTORY_SEPARATOR, $this->namespace);
4747
}
4848

4949
public function getFilename(): string
@@ -98,7 +98,7 @@ class CLASS
9898
{
9999
BODY
100100
}
101-
', ['NAMESPACE' => $this->getNamespace(), 'REQUIRE' => $require, 'CLASS' => $this->getName(), 'BODY' => $body]);
101+
', ['NAMESPACE' => $this->namespace, 'REQUIRE' => $require, 'CLASS' => $this->getName(), 'BODY' => $body]);
102102

103103
return $content;
104104
}
@@ -108,7 +108,7 @@ private function buildToArray()
108108
/*
109109
* Add toArray()
110110
*/
111-
$toArrayBody = '$output = [];';
111+
10000 $body = '$output = [];';
112112
foreach ($this->properties as $p) {
113113
$code = '$this->PROPERTY;';
114114
if (null !== $p->getType()) {
@@ -119,7 +119,7 @@ private function buildToArray()
119119
}
120120
}
121121

122-
$toArrayBody .= strtr('
122+
$body .= strtr('
123123
if (null !== $this->PROPERTY) {
124124
$output["ORG_NAME"] = '.$code.'
125125
}', ['PROPERTY' => $p->getName(), 'ORG_NAME' => $p->getOriginalName()]);
@@ -128,7 +128,7 @@ private function buildToArray()
128128
$this->addMethod('toArray', '
129129
public function NAME(): array
130130
{
131-
'.$toArrayBody.'
131+
'.$body.'
132132
133133
return $output;
134134
}
@@ -137,7 +137,7 @@ public function NAME(): array
137137

138138
private function buildConstructor()
139139
{
140-
$constructorBody = '';
140+
$body = '';
141141
foreach ($this->properties as $p) {
142142
$code = '$value["PROPERTY"]';
143143
if (null !== $p->getType()) {
@@ -148,23 +148,23 @@ private function buildConstructor()
148148
}
149149
}
150150

151-
$constructorBody .= strtr('
151+
$body .= strtr('
152152
if (isset($value["PROPERTY"])) {
153153
$this->PROPERTY = '.$code.';
154154
unset($value["PROPERTY"]);
155155
}
156156
', ['PROPERTY' => $p->getName()]);
157157
}
158158

159-
$constructorBody .= '
159+
$body .= '
160160
if ($value !== []) {
161161
throw new \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(sprintf(\'The following keys are not supported by "%s": \', __CLASS__) . implode(\', \', array_keys($value)));
162162
}';
163163

164164
$this->addMethod('__construct', '
165165
public function __construct(array $value = [])
166166
{
167-
'.$constructorBody.'
167+
'.$body.'
168168
}
169169
');
170170
}
@@ -198,10 +198,6 @@ private function camelCase(string $input): string
198198
return preg_replace('#\W#', '', $output);
199199
}
200200

201-
public function getNamespace(): string
202-
{
203-
return $this->namespace;
204-
}
205201

206202
public function getName(): string
207203
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function build(ConfigurationInterface $configuration, string $outputDir):
4949
$str = $outputDir.\DIRECTORY_SEPARATOR.$rootClass->getFilePath().\DIRECTORY_SEPARATOR.$rootClass->getFilename();
5050
require_once $str;
5151

52-
$className = '\\'.$rootClass->getNamespace().'\\'.$rootClass->getName();
52+
$className = $rootClass->getFqcn();
5353

5454
return new $className();
5555
});

0 commit comments

Comments
 (0)
0