You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -47,6 +49,10 @@ public function __toString(): string
47
49
continue;
48
50
}
49
51
52
+
if (null === $value) {
53
+
thrownewRuntimeException('Attribute values cannot be null. If you want to remove an attribute, use the "remove()" method.');
54
+
}
55
+
50
56
if (false === $value) {
51
57
continue;
52
58
}
@@ -60,11 +66,6 @@ public function __toString(): string
60
66
continue;
61
67
}
62
68
63
-
if (null === $value) {
64
-
trigger_deprecation('symfony/ux-twig-component', '2.8.0', 'Passing "null" as an attribute value is deprecated and will throw an exception in 3.0.');
65
-
$value = true;
66
-
}
67
-
68
69
if (!\is_scalar($value) && !($valueinstanceof \Stringable)) {
69
70
thrownew \LogicException(\sprintf('A "%s" prop was passed when creating the component. No matching "%s" property or mount() argument was found, so we attempted to use this as an HTML attribute. But, the value is not a scalar (it\'s a "%s"). Did you mean to pass this to your component or is there a typo on its name?', $key, $key, get_debug_type($value)));
70
71
}
@@ -198,33 +199,6 @@ public function without(string ...$keys): self
198
199
return$clone;
199
200
}
200
201
201
-
publicfunctionadd($stimulusDto): self
202
-
{
203
-
if ($stimulusDtoinstanceof AbstractStimulusDto) {
204
-
trigger_deprecation('symfony/ux-twig-component', '2.9.0', 'Passing a StimulusDto to ComponentAttributes::add() is deprecated. Run "composer require symfony/stimulus-bundle" then use "attributes.defaults(stimulus_controller(\'...\'))".');
trigger_deprecation('symfony/ux-twig-component', '2.9.0', 'Calling ComponentAttributes::add() is deprecated. Instead use "attributes.defaults(stimulus_controller(\'...\'))".');
207
-
208
-
return$this->defaults($stimulusDto);
209
-
} else {
210
-
thrownew \InvalidArgumentException(\sprintf('Argument 1 passed to "%s()" must be an instance of "%s" or "%s", "%s" given.', __METHOD__, AbstractStimulusDto::class, StimulusAttributes::class, get_debug_type($stimulusDto)));
trigger_deprecation('symfony/ux-twig-component', '2.13', 'The "%s()" method will require "%s $loader" as first argument in 3.0. Passing an "Environment" instance is deprecated.', __METHOD__, LoaderInterface::class);
30
-
$loader = $loader->getLoader();
31
-
}
32
-
$this->loader = $loader;
33
-
if (null === $this->directory) {
34
-
trigger_deprecation('symfony/ux-twig-component', '2.13', 'The "%s()" method will require "string $directory" argument in 3.0. Not defining it or passing null is deprecated.', __METHOD__);
@@ -48,17 +46,13 @@ public function process(ContainerBuilder $container): void
48
46
49
47
foreach ($tagsas$tag) {
50
48
if (!\array_key_exists('key', $tag)) {
51
-
if ($legacyAutoNaming) {
52
-
$name = substr($fqcn, strrpos($fqcn, '\\') + 1);
53
-
} else {
54
-
if (null === $defaults) {
55
-
thrownewLogicException(\sprintf('Could not generate a component name for class "%s": no matching namespace found under the "twig_component.defaults" to use as a root. Check the config or give your component an explicit name.', $fqcn));
thrownewLogicException(\sprintf('Could not generate a component name for class "%s": no matching namespace found under the "twig_component.defaults" to use as a root. Check the config or give your component an explicit name.', $fqcn));
thrownewLogicException(\sprintf('Failed creating the "%s" component with the automatic name "%s": another component already has this name. To fix this, give the component an explicit name (hint: using "%s" will override the existing component).', $fqcn, $name, $name));
if ($defaults === [self::DEPRECATED_DEFAULT_KEY]) {
66
-
trigger_deprecation('symfony/ux-twig-component', '2.13', 'Not setting the "twig_component.defaults" config option is deprecated. Check the documentation for an example configuration.');
if ($container->getParameter('kernel.debug') && $config['profiler']) {
154
143
$loader->load('debug.php');
155
144
}
@@ -170,19 +159,9 @@ public function getConfigTreeBuilder(): TreeBuilder
170
159
\assert($rootNodeinstanceof ArrayNodeDefinition);
171
160
172
161
$rootNode
173
-
->validate()
174
-
->always(function ($v) {
175
-
if (!isset($v['anonymous_template_directory'])) {
176
-
trigger_deprecation('symfony/twig-component-bundle', '2.13', 'Not setting the "twig_component.anonymous_template_directory" config option is deprecated. It will default to "components" in 3.0.');
177
-
$v['anonymous_template_directory'] = null;
178
-
}
179
-
180
-
return$v;
181
-
})
182
-
->end()
183
162
->children()
184
163
->arrayNode('defaults')
185
-
->defaultValue([self::DEPRECATED_DEFAULT_KEY])
164
+
->isRequired()
186
165
->useAttributeAsKey('namespace')
187
166
->validate()
188
167
->always(function ($v) {
@@ -213,16 +192,13 @@ public function getConfigTreeBuilder(): TreeBuilder
213
192
->end()
214
193
->end()
215
194
->scalarNode('anonymous_template_directory')
195
+
->isRequired()
216
196
->info('Defaults to `components`')
217
197
->end()
218
198
->booleanNode('profiler')
219
199
->info('Enables the profiler for Twig Component (in debug mode)')
220
200
->defaultValue('%kernel.debug%')
221
201
->end()
222
-
->scalarNode('controllers_json')
223
-
->setDeprecated('symfony/ux-twig-component', '2.18', 'The "twig_component.controllers_json" config option is deprecated, and will be removed in 3.0.')
Copy file name to clipboardExpand all lines: src/TwigComponent/src/Event/PostMountEvent.php
+2-21Lines changed: 2 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -19,31 +19,12 @@
19
19
*/
20
20
finalclass PostMountEvent extends Event
21
21
{
22
-
private ?ComponentMetadata$metadata;
23
-
privatearray$extraMetadata;
24
-
25
22
publicfunction__construct(
26
23
privateobject$component,
27
24
privatearray$data,
28
-
array|ComponentMetadata$metadata = [],
29
-
$extraMetadata = [],
25
+
private ?ComponentMetadata$metadata = null,
26
+
privatearray$extraMetadata = [],
30
27
) {
31
-
if (\is_array($metadata)) {
32
-
trigger_deprecation('symfony/ux-twig-component', '2.13', 'In TwigComponent 3.0, the third argument of "%s()" will be a "%s" object and the "$extraMetadata" array should be passed as the fourth argument.', __METHOD__, ComponentMetadata::class);
33
-
34
-
$this->metadata = null;
35
-
$this->extraMetadata = $metadata;
36
-
} else {
37
-
if (null !== $metadata && !$metadatainstanceof ComponentMetadata) {
38
-
thrownew \InvalidArgumentException(\sprintf('Expecting "$metadata" to be null or an instance of "%s", given: "%s."', ComponentMetadata::class, get_debug_type($metadata)));
39
-
}
40
-
if (!\is_array($extraMetadata)) {
41
-
thrownew \InvalidArgumentException(\sprintf('Expecting "$extraMetadata" to be array, given: "%s".', get_debug_type($extraMetadata)));
trigger_deprecation('symfony/ux-twig-component', '2.13', 'In TwigComponent 3.0, "%s()" method will require a "%s $metadata" argument. Not passing it is deprecated.', __METHOD__, ComponentMetadata::class);
0 commit comments