Skip to content

Commit b0cfaa7

Browse files
committed
removed Engine::$probe
1 parent c4b37c2 commit b0cfaa7

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/Bridges/Tracy/LattePanel.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace Latte\Bridges\Tracy;
1111

1212
use Latte\Engine;
13+
use Latte\Extension;
1314
use Latte\Runtime\Template;
1415
use Tracy;
1516

@@ -37,9 +38,18 @@ public static function initialize(Engine $latte, ?string $name = null, ?Tracy\Ba
3738
public function __construct(Engine $latte, ?string $name = null)
3839
{
3940
$this->name = $name;
40-
$latte->probe = function (Template $template): void {
41-
$this->templates[] = $template;
42-
};
41+
$latte->addExtension(new class ($this->templates) extends Extension {
42+
public function __construct(
43+
private array &$templates,
44+
) {
45+
}
46+
47+
48+
public function beforeRender(Template $template): void
49+
{
50+
$this->templates[] = $template;
51+
}
52+
});
4353
}
4454

4555

src/Latte/Engine.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class Engine
3131
CONTENT_ICAL = ContentType::ICal,
3232
CONTENT_TEXT = ContentType::Text;
3333

34-
/** @internal */
35-
public $probe;
36-
3734
private ?Loader $loader = null;
3835
private Runtime\FilterExecutor $filters;
3936
private \stdClass $functions;
@@ -54,7 +51,6 @@ public function __construct()
5451
$this->filters = new Runtime\FilterExecutor;
5552
$this->functions = new \stdClass;
5653
$this->providers = new \stdClass;
57-
$this->probe = function () {};
5854
$this->addExtension(new Essential\CoreExtension);
5955
$this->addExtension(new Sandbox\SandboxExtension);
6056
}
@@ -68,7 +64,6 @@ public function render(string $name, object|array $params = [], ?string $block =
6864
{
6965
$template = $this->createTemplate($name, $this->processParams($params));
7066
$template->global->coreCaptured = false;
71-
($this->probe)($template);
7267
$template->render($block);
7368
}
7469

@@ -81,7 +76,6 @@ public function renderToString(string $name, object|array $params = [], ?string
8176
{
8277
$template = $this->createTemplate($name, $this->processParams($params));
8378
$template->global->coreCaptured = true;
84-
($this->probe)($template);
8579
return $template->capture(fn() => $template->render($block));
8680
}
8781

src/Latte/Runtime/Template.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ public function createTemplate(string $name, array $params, string $referenceTyp
189189
$referred->blocks[self::LayerSnippet] = &$this->blocks[self::LayerSnippet];
190190
}
191191

192-
($this->engine->probe)($referred);
193192
return $referred;
194193
}
195194

0 commit comments

Comments
 (0)