Skip to content

Commit d60eada

Browse files
committed
Cleanup
1 parent 9d6c345 commit d60eada

File tree

9 files changed

+55
-429
lines changed

9 files changed

+55
-429
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CHANGELOG
1717
* Add support for union types with `Symfony\Component\EventDispatcher\Attribute\AsEventListener`
1818
* Add `framework.allowed_http_method_override` option
1919
* Initialize `router.request_context`'s `_locale` parameter to `%kernel.default_locale%`
20-
* Generate JSON schema for YAML configuration of bundles
2120

2221
7.3
2322
---

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigSchemaCacheWarmer.php

Lines changed: 0 additions & 109 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Clock\ClockInterface as PsrClockInterface;
1515
use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
1616
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer;
17-
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigSchemaCacheWarmer;
1817
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
1918
use Symfony\Component\Clock\Clock;
2019
use Symfony\Component\Clock\ClockInterface;
@@ -239,10 +238,6 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
239238
->args([service(KernelInterface::class), service('logger')->nullOnInvalid()])
240239
->tag('kernel.cache_warmer')
241240

242-
->set('config_schema.warmer', ConfigSchemaCacheWarmer::class)
243-
->args([service(KernelInterface::class), service('logger')->nullOnInvalid()])
244-
->tag('kernel.cache_warmer')
245-
246241
->set('clock', Clock::class)
247242
->alias(ClockInterface::class, 'clock')
248243
->alias(PsrClockInterface::class, 'clock')

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

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,24 @@ public function generateNode(NodeInterface $node): \stdClass
5151
$prototypeSchema = $this->generateNode($node->getPrototype());
5252

5353
if ($node->getKeyAttribute()) {
54-
$obj = new \stdClass();
55-
$obj->type = 'object';
56-
$obj->additionalProperties = $prototypeSchema;
57-
return $obj;
58-
}
54+
$schema = (object) [
55+
'type' => 'object',
56+
'additionalProperties' => $prototypeSchema,
57+
];
5958

60-
$schema = (object) ['type' => ['array'], 'items' => $prototypeSchema];
59+
if ($node->getMinNumberOfElements()) {
60+
$schema->minProperties = $node->getMinNumberOfElements();
61+
}
62+
} else {
63+
$schema = (object) [
64+
'type' => 'array',
65+
'items' => $prototypeSchema
66+
];
67+
68+
if ($node->getMinNumberOfElements()) {
69+
$schema->minItems = $node->getMinNumberOfElements();
70+
}
71+
}
6172
} elseif ($node instanceof ArrayNode) {
6273
$schema = (object) ['type' => ['object']];
6374
$children = $node->getChildren();
@@ -124,13 +135,13 @@ public function generateNode(NodeInterface $node): \stdClass
124135
}
125136

126137
if ($normalizedTypes) {
127-
$schema = (object) [
138+
$schema = (object)[
128139
'$anyOf' => [
129140
$schema,
130-
(object) [
141+
(object)[
131142
'type' => array_values(
132143
array_unique(
133-
array_map(fn ($type) => match($type) {
144+
array_map(fn($type) => match ($type) {
134145
ExprBuilder::TYPE_INT => 'integer',
135146
ExprBuilder::TYPE_STRING => 'string',
136147
ExprBuilder::TYPE_BOOL => 'boolean',
@@ -145,7 +156,9 @@ public function generateNode(NodeInterface $node): \stdClass
145156
];
146157
}
147158

148-
$schema->type = array_values(array_unique($schema->type ?? []));
159+
if (is_array($schema->type ?? null)) {
160+
$schema->type = array_values(array_unique($schema->type));
161+
}
149162

150163
if ($node->hasDefaultValue() && !($node instanceof ArrayNode && $node->getDefaultValue() === [])) {
151164
$schema->default = $node->getDefaultValue();
@@ -165,9 +178,9 @@ public function generateNode(NodeInterface $node): \stdClass
165178
}
166179
}
167180

168-
if (!$schema->type) {
181+
if (empty($schema->type)) {
169182
unset($schema->type);
170-
} elseif (count($schema->type) === 1) {
183+
} elseif (is_array($schema->type) && count($schema->type) === 1) {
171184
$schema->type = $schema->type[0];
172185
}
173186

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ public function addEquivalentValue(mixed $originalValue, mixed $equivalentValue)
169169
$this->equivalentValues[] = [$originalValue, $equivalentValue];
170170
}
171171

172-
public function getEquivalentValues(): array
173-
{
174-
return $this->equivalentValues;
175-
}
176-
177172
/**
178173
* Set this node as required.
179174
*/

0 commit comments

Comments
 (0)