Skip to content
Snippets Groups Projects
Commit dc8237b4 authored by potreb's avatar potreb
Browse files

fix: devel merge, reformat

parent 3a9fb378
No related branches found
No related tags found
3 merge requests!28release: 3.0.0,!23Feature/strong typing pp,!19Add strong typing for 3.0 version
Pipeline #6434 passed
Showing
with 23 additions and 3 deletions
......@@ -20,7 +20,7 @@
"ext-curl": "*",
"ext-json": "*",
"wpdesk/wp-persistence": "^2.0|^3.0",
"wpdesk/wp-view": "^1.1"
"wpdesk/wp-view": "^2"
},
"require-dev": {
"phpunit/phpunit": "<7",
......
......@@ -4,7 +4,6 @@ namespace WPDesk\Forms;
use Psr\Container\ContainerInterface;
use WPDesk\Persistence\PersistentContainer;
use Psr\Container\ContainerInterface;
/**
* Persistent container support for forms.
......@@ -12,6 +11,7 @@ use Psr\Container\ContainerInterface;
* @package WPDesk\Forms
*/
interface ContainerForm {
/**
* @param ContainerInterface $data
*
......
......@@ -3,6 +3,7 @@
namespace WPDesk\Forms;
interface Escaper {
/** @param mixed $value */
public function escape( $value ): string;
}
......@@ -11,6 +11,7 @@ namespace WPDesk\Forms;
* @package WPDesk\Forms
*/
interface Field {
public function get_name(): string;
/** @return mixed */
......
......@@ -2,6 +2,7 @@
namespace WPDesk\Forms\Field;
use BadMethodCallException;
use WPDesk\Forms\Field;
use WPDesk\Forms\Sanitizer;
use WPDesk\Forms\Sanitizer\NoSanitize;
......@@ -17,6 +18,7 @@ use WPDesk\Forms\Validator\RequiredValidator;
* @package WPDesk\Forms
*/
abstract class BasicField implements Field {
use Field\Traits\HtmlAttributes;
const DEFAULT_PRIORITY = 10;
......@@ -57,7 +59,7 @@ abstract class BasicField implements Field {
}
public function get_serializer(): Serializer {
throw new \BadMethodCallException('You must define your serializer in a child class.');
throw new BadMethodCallException('You must define your serializer in a child class.');
}
final public function get_name(): string {
......
......@@ -3,6 +3,7 @@
namespace WPDesk\Forms\Field;
class ButtonField extends NoValueField {
public function get_template_name(): string {
return 'button';
}
......
......@@ -5,6 +5,7 @@ namespace WPDesk\Forms\Field;
use WPDesk\Forms\Field;
class CheckboxField extends BasicField {
const VALUE_TRUE = 'yes';
const VALUE_FALSE = 'no';
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Sanitizer;
use WPDesk\Forms\Sanitizer\TextFieldSanitizer;
class DatePickerField extends BasicField {
public function __construct() {
$this->add_class( 'date-picker' );
$this->set_placeholder( 'YYYY-MM-DD' );
......
......@@ -5,7 +5,9 @@ namespace WPDesk\Forms\Field;
use WPDesk\Forms\Field;
class Header extends NoValueField {
public function __construct() {
parent::__construct();
$this->meta['header_size'] = '';
}
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Sanitizer;
use WPDesk\Forms\Sanitizer\TextFieldSanitizer;
class HiddenField extends BasicField {
public function get_type(): string {
return 'hidden';
}
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Sanitizer;
use WPDesk\Forms\Sanitizer\EmailSanitizer;
class InputEmailField extends BasicField {
public function get_type(): string {
return 'email';
}
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Sanitizer;
use WPDesk\Forms\Sanitizer\TextFieldSanitizer;
class InputNumberField extends BasicField {
public function get_type(): string {
return 'number';
}
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Sanitizer;
use WPDesk\Forms\Sanitizer\TextFieldSanitizer;
class InputTextField extends BasicField {
public function get_sanitizer(): Sanitizer {
return new TextFieldSanitizer();
}
......
......@@ -3,6 +3,7 @@
namespace WPDesk\Forms\Field;
class MultipleInputTextField extends InputTextField {
public function get_template_name(): string {
return 'input-text-multiple';
}
......
......@@ -8,6 +8,7 @@ namespace WPDesk\Forms\Field;
* @package WPDesk\Forms
*/
abstract class NoValueField extends BasicField {
public function __construct() {
$this->set_name( '' );
}
......
......@@ -3,6 +3,7 @@
namespace WPDesk\Forms\Field;
class Paragraph extends NoValueField {
public function get_template_name(): string {
return 'paragraph';
}
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Serializer\ProductSelectSerializer;
use WPDesk\Forms\Serializer;
class ProductSelect extends SelectField {
public function __construct() {
$this->set_multiple();
}
......
......@@ -3,6 +3,7 @@
namespace WPDesk\Forms\Field;
class RadioField extends BasicField {
public function get_template_name(): string {
return 'input-radio';
}
......
......@@ -3,6 +3,7 @@
namespace WPDesk\Forms\Field;
class SubmitField extends NoValueField {
public function get_template_name(): string {
return 'input-submit';
}
......
......@@ -6,6 +6,7 @@ use WPDesk\Forms\Serializer;
use WPDesk\Forms\Serializer\JsonSerializer;
class TimepickerField extends BasicField {
public function has_serializer(): bool {
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment