From fab5d47d07425a80751429afa31c402818ff8434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Brecher?= <34324008+mildabre@users.noreply.github.com> Date: Sat, 12 Oct 2024 09:55:26 +0200 Subject: [PATCH 1/2] Unify typehints of parameter $name in methods addFilter() On nette forum in this post: https://forum.nette.org/cs/36685-latte-addfilter-neni-tam-chyba#p227757 was reported error - mismatch between typehints of parameter $name in methods addFilter() in Nette\Bridges\ApplicationLatte\Template and Latte\Engine, the correct typehint is defined by typehint of second parameter of php function preg_match() which is string. Consequently the correct typehint of parameter $name in method Nette\Bridges\ApplicationLatte\Template::addFilter() is pure string not nullable string --- src/Bridges/ApplicationLatte/Template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bridges/ApplicationLatte/Template.php b/src/Bridges/ApplicationLatte/Template.php index 335e14440..6f11e7f11 100644 --- a/src/Bridges/ApplicationLatte/Template.php +++ b/src/Bridges/ApplicationLatte/Template.php @@ -72,7 +72,7 @@ public function __toString(): string /** * Registers run-time filter. */ - public function addFilter(?string $name, callable $callback): static + public function addFilter(string $name, callable $callback): static { $this->latte->addFilter($name, $callback); return $this; From 30026f64ced55b6552f48a4f2ae3cee3b94a9619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Brecher?= <34324008+mildabre@users.noreply.github.com> Date: Sat, 23 Nov 2024 19:18:23 +0100 Subject: [PATCH 2/2] Change of syntax of argument After changes of syntax in neon statements and added support for properties it is necessary to adjust syntax of argument 'withoutUserInfo' and add suffix '()' used now for methods --- src/Bridges/ApplicationDI/ApplicationExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bridges/ApplicationDI/ApplicationExtension.php b/src/Bridges/ApplicationDI/ApplicationExtension.php index a08080fe0..bb02c62fa 100644 --- a/src/Bridges/ApplicationDI/ApplicationExtension.php +++ b/src/Bridges/ApplicationDI/ApplicationExtension.php @@ -111,7 +111,7 @@ public function loadConfiguration(): void $builder->addDefinition($this->prefix('linkGenerator')) ->setFactory(Nette\Application\LinkGenerator::class, [ - 1 => new Definitions\Statement([new Definitions\Statement('@Nette\Http\IRequest::getUrl'), 'withoutUserInfo']), + 1 => new Definitions\Statement([new Definitions\Statement('@Nette\Http\IRequest::getUrl'), 'withoutUserInfo()']), ]); if ($this->name === 'application') {