diff --git a/src/LiveComponent/.gitignore b/src/LiveComponent/.gitignore index 1784dd6561c..6c06c7ffa62 100644 --- a/src/LiveComponent/.gitignore +++ b/src/LiveComponent/.gitignore @@ -3,5 +3,4 @@ /composer.lock /phpunit.xml /.phpunit.result.cache - /var diff --git a/src/LiveComponent/src/Attribute/AsLiveComponent.php b/src/LiveComponent/src/Attribute/AsLiveComponent.php index 497eed31f8f..570ad0c9264 100644 --- a/src/LiveComponent/src/Attribute/AsLiveComponent.php +++ b/src/LiveComponent/src/Attribute/AsLiveComponent.php @@ -49,28 +49,7 @@ public function __construct( string|bool $route = 'ux_live_component', string $method = 'post', int|string $urlReferenceType = UrlGeneratorInterface::ABSOLUTE_PATH, - public bool|int $csrf = true, // @deprecated ) { - if (8 < \func_num_args() || \is_bool($route)) { - trigger_deprecation('symfony/ux-live-component', '2.21', 'Argument "$csrf" of "#[%s]" has no effect anymore and is deprecated.', static::class); - } - if (\is_bool($route)) { - $this->csrf = $route; - $route = $method; - $method = $urlReferenceType; - $urlReferenceType = $csrf; - - switch (\func_num_args()) { - case 6: $route = 'ux_live_component'; - // no break - case 7: $method = 'post'; - // no break - case 8: $urlReferenceType = UrlGeneratorInterface::ABSOLUTE_PATH; - // no break - default: - } - } - parent::__construct($name, $template, $exposePublicProps, $attributesVar); $this->defaultAction = $defaultAction; @@ -78,7 +57,7 @@ public function __construct( $this->method = strtolower($method); $this->urlReferenceType = $urlReferenceType; - if (!\in_array($method, ['get', 'post'])) { + if (!\in_array($this->method, ['get', 'post'])) { throw new \UnexpectedValueException('$method must be either \'get\' or \'post\'.'); } } @@ -91,7 +70,6 @@ public function serviceConfig(): array return array_merge(parent::serviceConfig(), [ 'default_action' => $this->defaultAction, 'live' => true, - 'csrf' => $this->csrf, 'route' => $this->route, 'method' => $this->method, 'url_reference_type' => $this->urlReferenceType, diff --git a/src/LiveComponent/src/EventListener/DeferLiveComponentSubscriber.php b/src/LiveComponent/src/EventListener/DeferLiveComponentSubscriber.php index e7348b1826d..b051926fab3 100644 --- a/src/LiveComponent/src/EventListener/DeferLiveComponentSubscriber.php +++ b/src/LiveComponent/src/EventListener/DeferLiveComponentSubscriber.php @@ -34,14 +34,6 @@ public function onPostMount(PostMountEvent $event): void return; } - if (\array_key_exists('defer', $data)) { - trigger_deprecation('symfony/ux-live-component', '2.17', 'The "defer" attribute is deprecated and will be removed in 3.0. Use the "loading" attribute instead set to the value "defer".'); - if ($data['defer']) { - $event->addExtraMetadata('loading', 'defer'); - } - unset($data['defer']); - } - if (\array_key_exists('loading', $data)) { // Ignored values: false / null / '' if ($loading = $data['loading']) { diff --git a/src/LiveComponent/tests/Unit/EventListener/DeferLiveComponentSubscriberTest.php b/src/LiveComponent/tests/Unit/EventListener/DeferLiveComponentSubscriberTest.php index 5737c03a07f..741de46c486 100644 --- a/src/LiveComponent/tests/Unit/EventListener/DeferLiveComponentSubscriberTest.php +++ b/src/LiveComponent/tests/Unit/EventListener/DeferLiveComponentSubscriberTest.php @@ -49,37 +49,6 @@ public function testLoadingAttributeIsNotExtractedWhenComponentIsNotLive() $this->assertArrayHasKey('loading', $event->getData()); } - /** - * @group legacy - */ - public function testLoadingAttributeOverrideDeferAttribute() - { - $subscriber = new DeferLiveComponentSubscriber(); - $event = $this->createPostMountEvent(['loading' => 'lazy', 'defer' => true]); - - $this->expectDeprecation('Since symfony/ux-live-component 2.17: The "defer" attribute is deprecated and will be removed in 3.0. Use the "loading" attribute instead set to the value "defer".'); - - $subscriber->onPostMount($event); - - $this->assertArrayHasKey('loading', $event->getExtraMetadata()); - $this->assertSame('lazy', $event->getExtraMetadata()['loading']); - } - - /** - * @group legacy - */ - public function testDeferAttributeTriggerDeprecation() - { - $subscriber = new DeferLiveComponentSubscriber(); - $event = $this->createPostMountEvent([ - 'defer' => true, - ]); - - $this->expectDeprecation('Since symfony/ux-live-component 2.17: The "defer" attribute is deprecated and will be removed in 3.0. Use the "loading" attribute instead set to the value "defer".'); - - $subscriber->onPostMount($event); - } - public function testLoadingAttributesAreRemoved() { $subscriber = new DeferLiveComponentSubscriber();