Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-8.0-v3-php-${{ hashFiles('**/composer.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php81.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-8.1-v3-php-${{ hashFiles('**/composer.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion src/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class Element implements ElementInterface
protected bool $allowSameNames = false;


public function __construct(string $name, string $label = null)
public function __construct(string $name, ?string $label = null)
{
$this->setRequest();
$this->setName($name);
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Checkbox extends Element implements Fillable, Ruleable, Descriptionable
protected bool $allowSameNames = true;


public function __construct(string $name, string $title = null, bool $parent = true)
public function __construct(string $name, ?string $title = null, bool $parent = true)
{
$this->parent = $parent;
$this->originalName = trim($name);
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Datalist.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Datalist extends Element implements Fillable, Ruleable, Descriptionable
protected string $type = 'option';


public function __construct(string $name, string $title = null)
public function __construct(string $name, ?string $title = null)
{
parent::__construct($name, $title);
$this->setAttribute(AttributeFactory::create('list', $name . '-list'));
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class File extends Element implements Ruleable, Descriptionable
/**
* @throws ExceptionRule
*/
public function __construct(string $name, string $title = null)
public function __construct(string $name, ?string $title = null)
{
parent::__construct($name, $title);
$this->addRule(Rules::UPLOAD, [
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Group extends Element implements Descriptionable
use Description;
use Container;

public function __construct(string $title = null, string $id = null)
public function __construct(?string $title = null, ?string $id = null)
{
parent::__construct($id ?? \uniqid('group'), $title);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Image extends Element
{
protected string $type = 'image';

public function __construct(string $name, string $src = null)
public function __construct(string $name, ?string $src = null)
{
parent::__construct($name);
if (!is_null($src)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Option extends Element implements Fillable
protected string $type = 'option';


public function __construct(string $name, string $title = null)
public function __construct(string $name, ?string $title = null)
{
parent::__construct($name, $title);
$this->setAttributes(
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Radio extends Element implements Fillable, Ruleable, Descriptionable
private string $originalName;


public function __construct(string $name, string $title = null, bool $parent = true)
public function __construct(string $name, ?string $title = null, bool $parent = true)
{
$this->parent = $parent;
$this->originalName = $name;
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Reset extends Element
{
protected string $type = 'reset';

public function __construct(string $name = null, string $title = null)
public function __construct(string $name = null, ?string $title = null)
{
$name ??= uniqid('reset');

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Select extends Element implements Fillable, Ruleable, Descriptionable

protected string $type = 'option';

public function __construct(string $name, string $title = null)
public function __construct(string $name, ?string $title = null)
{
parent::__construct($name, $title);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Submit extends Element
{
protected string $type = 'submit';

public function __construct(string $name = null, string $title = null)
public function __construct(string $name = null, ?string $title = null)
{
if (is_null($name)) {
$name = uniqid('submit');
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Textarea extends Element implements Ruleable, Descriptionable

private string $value;

public function __construct(string $name, string $label = null)
public function __construct(string $name, ?string $label = null)
{
parent::__construct($name, $label);
$this->value = '';
Expand Down
10 changes: 5 additions & 5 deletions src/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class Form
*/
public function __construct(
string $method = 'POST',
string $action = null,
string $id = null,
ServerRequestInterface $request = null,
DefaultsHandlerInterface $defaultsHandler = null,
Session $session = null
?string $action = null,
?string $id = null,
?ServerRequestInterface $request = null,
?DefaultsHandlerInterface $defaultsHandler = null,
?Session $session = null
) {
$this->request = $request ?? ServerRequestCreator::createFromGlobals();
$this->session = $session ?? new Session();
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/AbstractRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class AbstractRenderer implements RendererInterface
{
private Form $form;

public function __construct(Form $form = null)
public function __construct(?Form $form = null)
{
$this->form = $form ?? new Form();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ abstract class Renderer
{
private Form $form;

public function __construct(Form $form = null)
public function __construct(?Form $form = null)
{
$this->form = $form ?? new Form();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Equal.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Equal implements RuleInterface
* @param array<array-key, scalar>|scalar $params
* @param string|null $message
*/
public function __construct(mixed $params, string $message = null)
public function __construct(mixed $params, ?string $message = null)
{

$this->params = (array) $params;
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/RuleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ interface RuleInterface
*/
public function validate(Ruleable $element): bool;

public function setRequest(ServerRequestInterface $request = null): void;
public function setRequest(?ServerRequestInterface $request = null): void;
}
2 changes: 1 addition & 1 deletion src/Rule/UploadCheck/RequiredCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RequiredCheck implements UploadCheckInterface
private Ruleable $element;
private ?string $message;

public function __construct(false|UploadedFileInterface $value, Ruleable $element, string $message = null)
public function __construct(false|UploadedFileInterface $value, Ruleable $element, ?string $message = null)
{
$this->value = $value;
$this->element = $element;
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/UploadCheck/SystemCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class SystemCheck implements UploadCheckInterface
private Ruleable $element;
private ?string $message;

public function __construct(false|UploadedFileInterface $value, Ruleable $element, string $message = null)
public function __construct(false|UploadedFileInterface $value, Ruleable $element, ?string $message = null)
{
$this->value = $value;
$this->element = $element;
Expand Down
58 changes: 29 additions & 29 deletions src/Traits/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@
use Webmozart\Assert\Assert;

/**
* @method Elements\Text text(string $name, string $label = null)
* @method Elements\Hidden hidden(string $name, string $value = null)
* @method Elements\Password password(string $name, string $label = null)
* @method Elements\Submit submit(string $name = null, string $title = null)
* @method Elements\Header header(string $title = null)
* @method Elements\Color color(string $name, string $label = null)
* @method Elements\Date date(string $name, string $label = null)
* @method Elements\Datetime datetime(string $name, string $label = null)
* @method Elements\Datetimelocal datetimelocal(string $name, string $label = null)
* @method Elements\Email email(string $name, string $label = null)
* @method Elements\Number number(string $name, string $label = null)
* @method Elements\Range range(string $name, string $label = null)
* @method Elements\Search search(string $name, string $label = null)
* @method Elements\Tel tel(string $name, string $label = null)
* @method Elements\Time time(string $name, string $label = null)
* @method Elements\Url url(string $name, string $label = null)
* @method Elements\Month month(string $name, string $label = null)
* @method Elements\Week week(string $name, string $label = null)
* @method Elements\Textarea textarea(string $name, string $label = null)
* @method Elements\Select select(string $name, string $label = null)
* @method Elements\Button button(string $name, string $title = null)
* @method Elements\Datalist datalist(string $name, string $label = null)
* @method Elements\Checkbox checkbox(string $name, string $label = null)
* @method Elements\Image image(string $name, string $src = null)
* @method Elements\Radio radio(string $name, string $title = null)
* @method Elements\Reset reset(string $name, string $title = null)
* @method Elements\Text text(string $name, null|string $label = null)
* @method Elements\Hidden hidden(string $name, null|string $value = null)
* @method Elements\Password password(string $name, null|string $label = null)
* @method Elements\Submit submit(null|string $name = null, null|string $title = null)
* @method Elements\Header header(null|string $title = null)
* @method Elements\Color color(string $name, null|string $label = null)
* @method Elements\Date date(string $name, null|string $label = null)
* @method Elements\Datetime datetime(string $name, null|string $label = null)
* @method Elements\Datetimelocal datetimelocal(string $name, null|string $label = null)
* @method Elements\Email email(string $name, null|string $label = null)
* @method Elements\Number number(string $name, null|string $label = null)
* @method Elements\Range range(string $name, null|string $label = null)
* @method Elements\Search search(string $name, null|string $label = null)
* @method Elements\Tel tel(string $name, null|string $label = null)
* @method Elements\Time time(string $name, null|string $label = null)
* @method Elements\Url url(string $name, null|string $label = null)
* @method Elements\Month month(string $name, null|string $label = null)
* @method Elements\Week week(string $name, null|string $label = null)
* @method Elements\Textarea textarea(string $name, null|string $label = null)
* @method Elements\Select select(string $name, null|string $label = null)
* @method Elements\Button button(string $name, null|string $title = null)
* @method Elements\Datalist datalist(string $name, null|string $label = null)
* @method Elements\Checkbox checkbox(string $name, null|string $label = null)
* @method Elements\Image image(string $name, null|string $src = null)
* @method Elements\Radio radio(string $name, null|string $title = null)
* @method Elements\Reset reset(string $name, null|string $title = null)
* @method Elements\Captcha captcha(CaptchaInterface $captcha)
* @method Elements\Group group(string $title = null)
* @method Elements\File file(string $name, string $label = null)
* @method Elements\Group group(null|string $title = null)
* @method Elements\File file(string $name, null|string $label = null)
* @method Elements\Csrf csrf()
* @method Elements\Html html(string $html)
*
Expand Down Expand Up @@ -68,7 +68,7 @@ public function __call(string $name, array $arguments): Element
/**
* @psalm-suppress MixedPropertyTypeCoercion
*/
public function addElement(Element $element, string $before = null, string $after = null): static
public function addElement(Element $element, ?string $before = null, ?string $after = null): static
{
$element->setRequest($this->getRequest());
if ($element->prepare() === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait Request
*/
private ServerRequestInterface $request;

public function setRequest(ServerRequestInterface $request = null): void
public function setRequest(?ServerRequestInterface $request = null): void
{
$this->request = $request ?? ServerRequestCreator::createFromGlobals();
}
Expand Down
Loading