From 4fb09827f16856db57940e68501038b112fd078c Mon Sep 17 00:00:00 2001 From: Amos Lee Date: Mon, 13 Feb 2023 17:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=208.0=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controls/DatePickerInput.php | 2 +- src/Renders/AdminFormRender.php | 6 +++--- src/Renders/BaseFormRender.php | 4 ++-- src/Renders/FormRender.php | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Controls/DatePickerInput.php b/src/Controls/DatePickerInput.php index 181e876..9dc132b 100644 --- a/src/Controls/DatePickerInput.php +++ b/src/Controls/DatePickerInput.php @@ -68,6 +68,6 @@ public function getControl(): Html }); "; - return $el . $script; + return $el->addHtml($script); } } diff --git a/src/Renders/AdminFormRender.php b/src/Renders/AdminFormRender.php index de41864..0083e73 100644 --- a/src/Renders/AdminFormRender.php +++ b/src/Renders/AdminFormRender.php @@ -11,7 +11,7 @@ class AdminFormRender extends BaseFormRender { use Nette\SmartObject; - var $type = 'post_meta'; + var mixed $type = 'post_meta'; public function __construct($type = 'post_meta') { @@ -44,11 +44,11 @@ public function __construct($type = 'post_meta') /** * 渲染一行 * - * @param \Nette\Forms\IControl $control + * @param \Nette\Forms\Control $control * * @return string */ - public function renderPair(Nette\Forms\IControl $control) + public function renderPair(Nette\Forms\Control $control): string { $pair = $this->getWrapper('pair container'); $pair->addHtml($this->renderLabel($control)); diff --git a/src/Renders/BaseFormRender.php b/src/Renders/BaseFormRender.php index 823edf3..3266c21 100644 --- a/src/Renders/BaseFormRender.php +++ b/src/Renders/BaseFormRender.php @@ -97,7 +97,7 @@ public function renderPairMulti(array $controls): string { $s = []; foreach ($controls as $control) { - if ( ! $control instanceof Nette\Forms\IControl) { + if ( ! $control instanceof Nette\Forms\Control) { throw new Nette\InvalidArgumentException('Argument must be array of Nette\Forms\IControl instances.'); } @@ -161,7 +161,7 @@ public function renderPairMulti(array $controls): string * * @return \Nette\Utils\Html|string */ - public function renderControlGroup($control) + public function renderControlGroup($control): Html|string { $html = ''; diff --git a/src/Renders/FormRender.php b/src/Renders/FormRender.php index cf2aa68..c02167e 100644 --- a/src/Renders/FormRender.php +++ b/src/Renders/FormRender.php @@ -4,7 +4,7 @@ use Nette; use Nette\Utils\Html; -use Nette\Utils\IHtmlString; +use Nette\HtmlStringable; /** * 转到表单到 HTML 输出 @@ -119,7 +119,7 @@ class FormRender extends Nette\Forms\Rendering\DefaultFormRenderer * * @return string */ - public function renderControls($parent) + public function renderControls($parent): string { if ( ! ($parent instanceof Nette\Forms\Container || $parent instanceof Nette\Forms\ControlGroup)) { throw new Nette\InvalidArgumentException('Argument must be Nette\Forms\Container or Nette\Forms\ControlGroup instance.'); @@ -249,7 +249,7 @@ public function renderPair(Nette\Forms\Control $control): string * * @return string */ - public function renderPairMulti(array $controls) :string + public function renderPairMulti(array $controls): string { $s = []; foreach ($controls as $control) { @@ -259,7 +259,7 @@ public function renderPairMulti(array $controls) :string $description = $control->getOption('description'); - if ($description instanceof IHtmlString) { + if ($description instanceof HtmlStringable) { $description = ' ' . $description;