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

Fix ModuleNode instanciation when $embeddedTemplates is null #4607

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

alexandre-daubois
Copy link
Contributor

Related to symfony/symfony#59886, in case $embeddedTemplates is null

@fabpot
Copy link
Contributor

fabpot commented Feb 28, 2025

Thank you @alexandre-daubois.

@fabpot fabpot merged commit 4692c36 into twigphp:3.x Feb 28, 2025
40 of 41 checks passed
@alexandre-daubois alexandre-daubois deleted the null-coalesce-deprec branch February 28, 2025 20:16
@@ -41,7 +41,7 @@ public function __construct(Node $body, ?AbstractExpression $parent, Node $block
if (!$embeddedTemplates instanceof Node) {
trigger_deprecation('twig/twig', '3.21', \sprintf('Not passing a "%s" instance as the "embedded_templates" argument of the "%s" constructor is deprecated.', Node::class, static::class));

$embeddedTemplates = new Nodes($embeddedTemplates);
$embeddedTemplates = new Nodes($embeddedTemplates ?? []);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about leveraging EmptyNode if $embeddedTemplates is null (see #4608)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

xabbuh added a commit to symfony/symfony that referenced this pull request Mar 1, 2025
… (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[TwigBridge] Fix `ModuleNode` call in `TwigNodeProvider`

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

After twigphp/Twig#4604, related to twigphp/Twig#4607

Commits
-------

a304e24 [TwigBridge] Fix `ModuleNode` call in `TwigNodeProvider`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants