diff --git a/composer.json b/composer.json index 728025e..3698e32 100644 --- a/composer.json +++ b/composer.json @@ -8,11 +8,11 @@ } ], "require": { - "krutush/template": "dev-master" + "krutush/template": "dev-develop" }, "autoload": { "psr-4": { "Krutush\\Form\\": "src/" } } -} \ No newline at end of file +} diff --git a/src/Element.php b/src/Element.php index c946c26..49bdfa4 100644 --- a/src/Element.php +++ b/src/Element.php @@ -21,12 +21,12 @@ class Element{ return $this; } - public function value(string $value) : self{ + public function value(string $value = null) : self{ $this->data['value'] = $value; return $this; } - public function get() : ?string{ + public function get(){ return $this->data['value']; } @@ -35,7 +35,7 @@ class Element{ return $this; } - public function valid(mixed $data)/* :bool|string */{ + public function valid($data)/* :bool|string */{ if((!isset($data) || empty($data)) && isset($this->data['required']) && $this->data['required'] == true) return 'requis'; diff --git a/src/Form.php b/src/Form.php index 4f87808..e95149b 100644 --- a/src/Form.php +++ b/src/Form.php @@ -12,7 +12,7 @@ class Form { private $errors = array(); private $set = false; - public function __construct(string $name, string $path, bool $extention = true, bool $folder = true){ + public function __construct(string $name, string $path, string $extention = null, bool $folder = true){ $this->name = $name; $tpl = new Html($path, $extention, $folder); $tpl->set($name, $this) @@ -145,7 +145,7 @@ function SelectOther(source, other){ $this->elements[] = $thing; } - public function get(string $name) : ?Element{ + public function get(string $name) : Element{ foreach($this->elements as $element){ if($element->name() == $name) return $element; diff --git a/src/Input.php b/src/Input.php index f65c6c8..c3e4a95 100644 --- a/src/Input.php +++ b/src/Input.php @@ -64,7 +64,7 @@ class Input extends Element{ return $this; } - public function valid(mixde $data)/*: bool|string*/{ + public function valid($data)/*: bool|string*/{ $parent = parent::valid($data); if($parent !== true || !isset($data)) diff --git a/src/Select.php b/src/Select.php index 5d8ba84..cdd10bc 100644 --- a/src/Select.php +++ b/src/Select.php @@ -33,7 +33,7 @@ class Select extends Element{ } - public function valid(mixed $data)/*: bool|string*/{ + public function valid($data)/*: bool|string*/{ $parent = parent::valid($data); if($parent !== true || !isset($data)) return $parent; diff --git a/src/TextArea.php b/src/TextArea.php index 89a8372..2224ceb 100644 --- a/src/TextArea.php +++ b/src/TextArea.php @@ -3,7 +3,7 @@ namespace Krutush\Form; class TextArea extends Element{ - public function valid(mixed $data)/*: bool|string*/{ + public function valid($data)/*: bool|string*/{ return parent::valid($data); }