Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StimulusBundle/TwigComponent] Fix "use_yield" to "true" deprecation notice in CI #1478

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/StimulusBundle/src/Helper/StimulusHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ final class StimulusHelper
public function __construct(?Environment $twig)
{
// Twig needed just for its escaping mechanism
$this->twig = $twig ?? new Environment(new ArrayLoader());
$this->twig = $twig ?? new Environment(new ArrayLoader(), [
'use_yield' => true,
]);
}

public function createStimulusAttributes(): StimulusAttributes
Expand Down
4 changes: 3 additions & 1 deletion src/StimulusBundle/tests/Dto/StimulusAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ final class StimulusAttributesTest extends TestCase

protected function setUp(): void
{
$this->stimulusAttributes = new StimulusAttributes(new Environment(new ArrayLoader()));
$this->stimulusAttributes = new StimulusAttributes(new Environment(new ArrayLoader(), [
'use_yield' => true,
]));
}

public function testAddAction(): void
Expand Down
8 changes: 6 additions & 2 deletions src/TwigComponent/tests/Unit/ComponentAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public function testCanAddStimulusControllerViaStimulusAttributes(): void
'data-live-data-value' => '{}',
]);

$stimulusAttributes = new StimulusAttributes(new Environment(new ArrayLoader()));
$stimulusAttributes = new StimulusAttributes(new Environment(new ArrayLoader(), [
'use_yield' => true,
]));
$stimulusAttributes->addController('foo', ['name' => 'ryan', 'some_array' => ['a', 'b']]);
$attributes = $attributes->defaults($stimulusAttributes);

Expand All @@ -158,7 +160,9 @@ public function testCanAddStimulusActionViaStimulusAttributes(): void
'data-action' => 'live#foo',
]);

$stimulusAttributes = new StimulusAttributes(new Environment(new ArrayLoader()));
$stimulusAttributes = new StimulusAttributes(new Environment(new ArrayLoader(), [
'use_yield' => true,
]));
$stimulusAttributes->addAction('foo', 'barMethod');
$attributes = $attributes->defaults([...$stimulusAttributes]);

Expand Down
Loading