From 99383c900d165b9cb1faa3b568a4c87e7a179715 Mon Sep 17 00:00:00 2001 From: nidjo Date: Fri, 3 Jul 2026 11:08:03 +0200 Subject: [PATCH] =?UTF-8?q?nette/forms=203.2.9=20=E2=80=94=20fixes=20NAME?= =?UTF-8?q?=5FSEPARATOR=20deprecation=20on=20PHP=208.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nette/forms 3.2.9 replaces the deprecated IComponent::NAME_SEPARATOR constant (marked #[\Deprecated] in nette/component-model 3.2, emitting E_USER_DEPRECATED on every form render under PHP 8.4). 3.2.9 also ships stricter native/phpDoc types, so getControls() is now typed as iterable of Nette\Forms\Control — guard option access in BootstrapRenderer and type the DateInput validation rule accordingly. --- composer.json | 2 +- src/BootstrapRenderer.php | 8 +++++++- src/Inputs/DateInput.php | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index dcc6172..117a375 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": ">=8.1", - "nette/forms": "3.2.8", + "nette/forms": "3.2.9", "nette/application": "^3.0" }, "require-dev": { diff --git a/src/BootstrapRenderer.php b/src/BootstrapRenderer.php index ac894ad..6da04d0 100644 --- a/src/BootstrapRenderer.php +++ b/src/BootstrapRenderer.php @@ -328,7 +328,9 @@ public function render(Form $form): string public function renderBegin(): string { foreach ($this->form->getControls() as $control) { - $control->setOption(RendererOptions::_RENDERED, false); + if ($control instanceof BaseControl || $control instanceof BootstrapRow) { + $control->setOption(RendererOptions::_RENDERED, false); + } } /** @var Html $el */ @@ -462,6 +464,10 @@ public function renderControls($parent): string // note that these are NOT form groups, these are groups specified to group foreach ($parent->getControls() as $control) { + if (!$control instanceof BaseControl && !$control instanceof BootstrapRow) { + continue; + } + if ($control->getOption(RendererOptions::_RENDERED)) { continue; } diff --git a/src/Inputs/DateInput.php b/src/Inputs/DateInput.php index c1e917f..e237308 100644 --- a/src/Inputs/DateInput.php +++ b/src/Inputs/DateInput.php @@ -5,6 +5,7 @@ use Contributte\FormsBootstrap\Enums\DateTimeFormat; use DateTime; use DateTimeInterface; +use Nette\Forms\Control; use Nette\NotSupportedException; use Nette\Utils\Html; @@ -54,7 +55,7 @@ public function __construct($label = null, ?int $maxLength = null) parent::__construct($label, null); - $this->addRule(fn ($input) => DateTimeFormat::validate($this->format, $input->value), $this->invalidFormatMessage); + $this->addRule(fn (Control $input) => DateTimeFormat::validate($this->format, $input->getValue()), $this->invalidFormatMessage); $this->setFormat(static::$defaultFormat); }