Skip to content

Commit

Permalink
YieldReady (#443)
Browse files Browse the repository at this point in the history
* YieldReady

* CS
  • Loading branch information
barryvdh committed Apr 24, 2024
1 parent 412cbdc commit 4317a27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/Node/EventNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
use Illuminate\Support\Str;
use Illuminate\View\View;
use Illuminate\View\ViewName;
use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Node;

#[YieldReady]
class EventNode extends Node
{

public function compile(Compiler $compiler): void
{
$compiler
->write(
sprintf(
'$context = ' .
EventNode::class . '::triggerLaravelEvents($this->getTemplateName(), $context);'
)
'$context = ' . EventNode::class . '::triggerLaravelEvents($this->getTemplateName(), $context);'
)
->raw("\n");
}
Expand Down
13 changes: 12 additions & 1 deletion src/Node/GetAttrNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace TwigBridge\Node;

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Environment;
use Twig\Error\RuntimeError;
Expand All @@ -24,6 +25,7 @@
* - https://github.com/rcrowe/TwigBridge/issues/362
* - https://github.com/rcrowe/TwigBridge/issues/265
*/
#[YieldReady]
class GetAttrNode extends GetAttrExpression
{
/**
Expand Down Expand Up @@ -145,6 +147,15 @@ public static function attribute(
return $object->$item;
}

return CoreExtension::getAttribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
return CoreExtension::getAttribute(
$env,
$source,
$object,
$item,
$arguments,
$type,
$isDefinedTest,
$ignoreStrictCheck
);
}
}

0 comments on commit 4317a27

Please sign in to comment.