Skip to content

Commit cfc7861

Browse files
committed
requires nette/utils 3.2
1 parent b7fe4d1 commit cfc7861

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"php": ">=7.2",
1919
"nette/component-model": "^3.0",
2020
"nette/http": "^3.0",
21-
"nette/utils": "^3.0"
21+
"nette/utils": "^3.2"
2222
},
2323
"require-dev": {
2424
"nette/application": "^3.0",

examples/localization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Debugger::enable();
2020

2121

22-
class MyTranslator implements Nette\Localization\ITranslator
22+
class MyTranslator implements Nette\Localization\Translator
2323
{
2424
private $table;
2525

src/Forms/ControlGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public function getControls(): array
8181
/**
8282
* Sets user-specific option.
8383
* Options recognized by DefaultFormRenderer
84-
* - 'label' - textual or IHtmlString object label
84+
* - 'label' - textual or Nette\HtmlStringable object label
8585
* - 'visual' - indicates visual group
8686
* - 'container' - container as Html object
87-
* - 'description' - textual or IHtmlString object description
87+
* - 'description' - textual or Nette\HtmlStringable object description
8888
* - 'embedNext' - describes how render next group
8989
*
9090
* @return static

src/Forms/Controls/BaseControl.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract class BaseControl extends Nette\ComponentModel\Component implements Con
6868
/** @var Rules */
6969
private $rules;
7070

71-
/** @var Nette\Localization\ITranslator|bool|null */
71+
/** @var Nette\Localization\Translator|bool|null */
7272
private $translator = true; // means autodetect
7373

7474
/** @var array user options */
@@ -275,7 +275,7 @@ public function getLabel($caption = null)
275275
$label->for = $this->getHtmlId();
276276
$caption = $caption ?? $this->caption;
277277
$translator = $this->getForm()->getTranslator();
278-
$label->setText($translator && !$caption instanceof Nette\Utils\IHtmlString ? $translator->translate($caption) : $caption);
278+
$label->setText($translator && !$caption instanceof Nette\HtmlStringable ? $translator->translate($caption) : $caption);
279279
return $label;
280280
}
281281

@@ -376,7 +376,7 @@ public function setAttribute(string $name, $value = true)
376376
* Sets translate adapter.
377377
* @return static
378378
*/
379-
public function setTranslator(?Nette\Localization\ITranslator $translator)
379+
public function setTranslator(?Nette\Localization\Translator $translator)
380380
{
381381
$this->translator = $translator;
382382
return $this;
@@ -386,7 +386,7 @@ public function setTranslator(?Nette\Localization\ITranslator $translator)
386386
/**
387387
* Returns translate adapter.
388388
*/
389-
public function getTranslator(): ?Nette\Localization\ITranslator
389+
public function getTranslator(): ?Nette\Localization\Translator
390390
{
391391
if ($this->translator === true) {
392392
return $this->getForm(false)
@@ -406,7 +406,7 @@ public function translate($value, ...$parameters)
406406
if ($translator = $this->getTranslator()) {
407407
$tmp = is_array($value) ? [&$value] : [[&$value]];
408408
foreach ($tmp[0] as &$v) {
409-
if ($v != null && !$v instanceof Nette\Utils\IHtmlString) { // intentionally ==
409+
if ($v != null && !$v instanceof Nette\HtmlStringable) { // intentionally ==
410410
$v = $translator->translate($v, ...$parameters);
411411
}
412412
}

src/Forms/Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @property string $action
2424
* @property string $method
2525
*/
26-
class Form extends Container implements Nette\Utils\IHtmlString
26+
class Form extends Container implements Nette\HtmlStringable
2727
{
2828
/** validator */
2929
public const
@@ -108,7 +108,7 @@ class Form extends Container implements Nette\Utils\IHtmlString
108108
/** @var FormRenderer */
109109
private $renderer;
110110

111-
/** @var Nette\Localization\ITranslator */
111+
/** @var Nette\Localization\Translator */
112112
private $translator;
113113

114114
/** @var ControlGroup[] */
@@ -296,7 +296,7 @@ public function getGroup($name): ?ControlGroup
296296
* Sets translate adapter.
297297
* @return static
298298
*/
299-
public function setTranslator(?Nette\Localization\ITranslator $translator)
299+
public function setTranslator(?Nette\Localization\Translator $translator)
300300
{
301301
$this->translator = $translator;
302302
return $this;
@@ -306,7 +306,7 @@ public function setTranslator(?Nette\Localization\ITranslator $translator)
306306
/**
307307
* Returns translate adapter.
308308
*/
309-
public function getTranslator(): ?Nette\Localization\ITranslator
309+
public function getTranslator(): ?Nette\Localization\Translator
310310
{
311311
return $this->translator;
312312
}

src/Forms/Helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static function exportRules(Rules $rules): array
119119
}
120120
} else {
121121
$msg = Validator::formatMessage($rule, false);
122-
if ($msg instanceof Nette\Utils\IHtmlString) {
122+
if ($msg instanceof Nette\HtmlStringable) {
123123
$msg = html_entity_decode(strip_tags((string) $msg), ENT_QUOTES | ENT_HTML5, 'UTF-8');
124124
}
125125
$item = ['op' => ($rule->isNegative ? '~' : '') . $op, 'msg' => $msg];
@@ -168,7 +168,7 @@ public static function createInputList(
168168
$res .= ($res === '' && $wrapperEnd === '' ? '' : $wrapper)
169169
. $labelTag . $label->attributes() . '>'
170170
. $inputTag . $input->attributes() . (Html::$xhtml ? ' />' : '>')
171-
. ($caption instanceof Nette\Utils\IHtmlString ? $caption : htmlspecialchars((string) $caption, ENT_NOQUOTES, 'UTF-8'))
171+
. ($caption instanceof Nette\HtmlStringable ? $caption : htmlspecialchars((string) $caption, ENT_NOQUOTES, 'UTF-8'))
172172
. '</label>'
173173
. $wrapperEnd;
174174
}

src/Forms/Rendering/DefaultFormRenderer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use Nette;
1313
use Nette\Utils\Html;
14-
use Nette\Utils\IHtmlString;
14+
use Nette\HtmlStringable;
1515

1616

1717
/**
@@ -232,7 +232,7 @@ private function doRenderErrors(array $errors, bool $control): string
232232

233233
foreach ($errors as $error) {
234234
$item = clone $item;
235-
if ($error instanceof IHtmlString) {
235+
if ($error instanceof HtmlStringable) {
236236
$item->addHtml($error);
237237
} else {
238238
$item->setText($error);
@@ -274,7 +274,7 @@ public function renderBody(): string
274274
$s .= "\n" . $container->startTag();
275275

276276
$text = $group->getOption('label');
277-
if ($text instanceof IHtmlString) {
277+
if ($text instanceof HtmlStringable) {
278278
$s .= $this->getWrapper('group label')->addHtml($text);
279279

280280
} elseif ($text != null) { // intentionally ==
@@ -285,7 +285,7 @@ public function renderBody(): string
285285
}
286286

287287
$text = $group->getOption('description');
288-
if ($text instanceof IHtmlString) {
288+
if ($text instanceof HtmlStringable) {
289289
$s .= $text;
290290

291291
} elseif ($text != null) { // intentionally ==
@@ -389,7 +389,7 @@ public function renderPairMulti(array $controls): string
389389
throw new Nette\InvalidArgumentException('Argument must be array of Nette\Forms\IControl instances.');
390390
}
391391
$description = $control->getOption('description');
392-
if ($description instanceof IHtmlString) {
392+
if ($description instanceof HtmlStringable) {
393393
$description = ' ' . $description;
394394

395395
} elseif ($description != null) { // intentionally ==
@@ -453,7 +453,7 @@ public function renderControl(Nette\Forms\Control $control): Html
453453
}
454454

455455
$description = $control->getOption('description');
456-
if ($description instanceof IHtmlString) {
456+
if ($description instanceof HtmlStringable) {
457457
$description = ' ' . $description;
458458

459459
} elseif ($description != null) { // intentionally ==

src/Forms/Validator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ class Validator
4848

4949

5050
/**
51-
* @return string|Nette\Utils\IHtmlString
51+
* @return string|Nette\HtmlStringable
5252
* @internal
5353
*/
5454
public static function formatMessage(Rule $rule, bool $withValue = true)
5555
{
5656
$message = $rule->message;
57-
if ($message instanceof Nette\Utils\IHtmlString) {
57+
if ($message instanceof Nette\HtmlStringable) {
5858
return $message;
5959

6060
} elseif ($message === null && is_string($rule->validator) && isset(static::$messages[$rule->validator])) {
@@ -75,7 +75,7 @@ public static function formatMessage(Rule $rule, bool $withValue = true)
7575
case 'label':
7676
if ($rule->control instanceof Controls\BaseControl) {
7777
$caption = $rule->control->getCaption();
78-
$caption = $caption instanceof Nette\Utils\IHtmlString
78+
$caption = $caption instanceof Nette\HtmlStringable
7979
? $caption->getText()
8080
: ($translator ? $translator->translate($caption) : $caption);
8181
return rtrim((string) $caption, ':');

0 commit comments

Comments
 (0)