From 31bc0a37364b409df212007939f9da35cfe42ff7 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 6 Apr 2016 00:17:58 +0200 Subject: [PATCH] uses Nette\SmartObject & StaticClass --- composer.json | 4 ++-- src/Bridges/FormsLatte/Runtime.php | 3 ++- src/Forms/ControlGroup.php | 4 +++- src/Forms/Helpers.php | 4 +++- src/Forms/Rendering/DefaultFormRenderer.php | 4 +++- src/Forms/Rule.php | 4 +++- src/Forms/Rules.php | 4 +++- src/Forms/Validator.php | 4 +++- 8 files changed, 22 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 73572eea4..b505e44ba 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ ], "require": { "php": ">=5.6.0", - "nette/component-model": "~2.2", + "nette/component-model": "~2.3", "nette/http": "~2.2", - "nette/utils": "~2.2" + "nette/utils": "~2.4" }, "require-dev": { "nette/di": "~2.3", diff --git a/src/Bridges/FormsLatte/Runtime.php b/src/Bridges/FormsLatte/Runtime.php index 1df0cba47..4a3c7cf72 100644 --- a/src/Bridges/FormsLatte/Runtime.php +++ b/src/Bridges/FormsLatte/Runtime.php @@ -16,8 +16,9 @@ * Runtime helpers for Latte. * @internal */ -class Runtime extends Nette\Object +class Runtime { + use Nette\StaticClass; /** * Renders form begin. diff --git a/src/Forms/ControlGroup.php b/src/Forms/ControlGroup.php index 78d3d40fd..3d47cda6b 100644 --- a/src/Forms/ControlGroup.php +++ b/src/Forms/ControlGroup.php @@ -13,8 +13,10 @@ /** * A user group of form controls. */ -class ControlGroup extends Nette\Object +class ControlGroup { + use Nette\SmartObject; + /** @var \SplObjectStorage */ protected $controls; diff --git a/src/Forms/Helpers.php b/src/Forms/Helpers.php index 18d9a40fe..da7fb2e9e 100644 --- a/src/Forms/Helpers.php +++ b/src/Forms/Helpers.php @@ -15,8 +15,10 @@ /** * Forms helpers. */ -class Helpers extends Nette\Object +class Helpers { + use Nette\StaticClass; + private static $unsafeNames = [ 'attributes', 'children', 'elements', 'focus', 'length', 'reset', 'style', 'submit', 'onsubmit', 'form', 'presenter', 'action', diff --git a/src/Forms/Rendering/DefaultFormRenderer.php b/src/Forms/Rendering/DefaultFormRenderer.php index 1016ea8c7..a6ad55d39 100644 --- a/src/Forms/Rendering/DefaultFormRenderer.php +++ b/src/Forms/Rendering/DefaultFormRenderer.php @@ -14,8 +14,10 @@ /** * Converts a Form into the HTML output. */ -class DefaultFormRenderer extends Nette\Object implements Nette\Forms\IFormRenderer +class DefaultFormRenderer implements Nette\Forms\IFormRenderer { + use Nette\SmartObject; + /** * /--- form.container * diff --git a/src/Forms/Rule.php b/src/Forms/Rule.php index ad52bc3d9..549fc13c7 100644 --- a/src/Forms/Rule.php +++ b/src/Forms/Rule.php @@ -13,8 +13,10 @@ /** * Single validation rule or condition represented as value object. */ -class Rule extends Nette\Object +class Rule { + use Nette\SmartObject; + /** @var IControl */ public $control; diff --git a/src/Forms/Rules.php b/src/Forms/Rules.php index 249cdcb70..9251b5923 100644 --- a/src/Forms/Rules.php +++ b/src/Forms/Rules.php @@ -13,8 +13,10 @@ /** * List of validation & condition rules. */ -class Rules extends Nette\Object implements \IteratorAggregate +class Rules implements \IteratorAggregate { + use Nette\SmartObject; + /** @deprecated */ public static $defaultMessages; diff --git a/src/Forms/Validator.php b/src/Forms/Validator.php index 6b1df7792..b79fa227a 100644 --- a/src/Forms/Validator.php +++ b/src/Forms/Validator.php @@ -15,8 +15,10 @@ /** * Common validators. */ -class Validator extends Nette\Object +class Validator { + use Nette\StaticClass; + /** @var array */ public static $messages = [ Form::PROTECTION => 'Your session has expired. Please return to the home page and try again.',