Skip to content
Snippets Groups Projects
Verified Commit 4a201377 authored by Dave Long's avatar Dave Long
Browse files

Issue #3477373 by finnsky, bbrala, longwave: Fix "Not passing an instance of...

Issue #3477373 by finnsky, bbrala, longwave: Fix "Not passing an instance of "TwigFunction" when creating a function of type "FunctionExpression" is deprecated."

(cherry picked from commit 4b762453)
parent d58d513d
No related branches found
No related tags found
14 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated,!103032838547 Fix punctuation rules for inline label suffix colon with CSS only,!10150Issue #3467294 by quietone, nod_, smustgrave, catch, longwave: Change string...,!10130Resolve #3480321 "Second level menu",!9936Issue #3483087: Check the module:// prefix in the translation server path and replace it with the actual module path,!9933Issue #3394728 by ankondrat4: Undefined array key "#prefix" and deprecated function: explode() in Drupal\file\Element\ManagedFile::uploadAjaxCallback(),!9914Issue #3451136 by quietone, gapple, ghost of drupal past: Improve...,!9882Draft: Issue #3481777 In bulk_form ensure the triggering element is the bulk_form button,!9839Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9815Issue #3480025: There is no way to remove entity cache items,!9757Issue #3478869 Add "All" or overview links to parent links,!9752Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9749Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior
Pipeline #297937 canceled
Pipeline: drupal

#297938

    ......@@ -28,8 +28,4 @@
    %The "PHPUnit\\Framework\\TestCase::__construct\(\)" method is considered internal.*You should not extend it from "Drupal\\[^"]+"%
    # Twig 3.
    %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "attach_library" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
    %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "add_component_context" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
    %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "render_var" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
    %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "validate_component_props" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
    %Since twig/twig 3.12: Twig Filter "spaceless" is deprecated%
    ......@@ -9,6 +9,7 @@
    use Drupal\Core\Render\Component\Exception\InvalidComponentException;
    use Drupal\Core\Theme\ComponentPluginManager;
    use Twig\Environment;
    use Twig\TwigFunction;
    use Twig\Node\Expression\ConstantExpression;
    use Twig\Node\Expression\FunctionExpression;
    use Twig\Node\ModuleNode;
    ......@@ -55,17 +56,17 @@ public function leaveNode(Node $node, Environment $env): ?Node {
    $print_nodes[] = new PrintNode(new ConstantExpression(sprintf('<!-- %s Component start: %s -->', $emoji, $component_id), $line), $line);
    }
    $print_nodes[] = new PrintNode(new FunctionExpression(
    'attach_library',
    new TwigFunction('attach_library', [$env->getExtension(TwigExtension::class), 'attachLibrary']),
    new Node([new ConstantExpression($component->getLibraryName(), $line)]),
    $line
    ), $line);
    $print_nodes[] = new PrintNode(new FunctionExpression(
    'add_component_context',
    new TwigFunction('add_component_context', [$env->getExtension(ComponentsTwigExtension::class), 'addAdditionalContext'], ['needs_context' => TRUE]),
    new Node([new ConstantExpression($component_id, $line)]),
    $line
    ), $line);
    $print_nodes[] = new PrintNode(new FunctionExpression(
    'validate_component_props',
    new TwigFunction('validate_component_props', [$env->getExtension(ComponentsTwigExtension::class), 'validateProps'], ['needs_context' => TRUE]),
    new Node([new ConstantExpression($component_id, $line)]),
    $line
    ), $line);
    ......
    ......@@ -3,6 +3,7 @@
    namespace Drupal\Core\Template;
    use Twig\Environment;
    use Twig\TwigFunction;
    use Twig\Node\Expression\FilterExpression;
    use Twig\Node\Expression\FunctionExpression;
    use Twig\Node\Node;
    ......@@ -47,7 +48,11 @@ public function leaveNode(Node $node, Environment $env): ?Node {
    $class = get_class($node);
    $line = $node->getTemplateLine();
    return new $class(
    new FunctionExpression('render_var', new Node([$node->getNode('expr')]), $line),
    new FunctionExpression(
    new TwigFunction('render_var', [$env->getExtension(TwigExtension::class), 'renderVar']),
    new Node([$node->getNode('expr')]),
    $line
    ),
    $line
    );
    }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment