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
10 changes: 2 additions & 8 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@ jobs:
strategy:
matrix:
php: [ 8.0, 8.1, 8.2, 8.3, 8.4 ]
laravel: [ ^8.79, ^9.50.2, 10.*, 11.*, 12.* ]
laravel: [ 10.*, 11.*, 12.* ]
dependency-version: [ stable, lowest ]
exclude:
- php: 8.4
laravel: ^8.79
- php: 8.3
laravel: ^8.79
- php: 8.2
laravel: ^8.79
- php: 8.1
laravel: 12.*
- php: 8.1
Expand Down Expand Up @@ -53,7 +47,7 @@ jobs:
- name: Register composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
Expand Down
4 changes: 2 additions & 2 deletions src/Aire.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function __construct(Factory $view_factory, Store $session_store, Closure
$this->form_resolver = $form_resolver;
$this->user_config = $config;

$this->setIdGenerator(function(Element $element, Form $form = null) {
$this->setIdGenerator(function(Element $element, ?Form $form = null) {
$form_id = $form->element_id ?? null;
$element_name = $element->getInputName();
$element_id = $element->element_id;
Expand Down Expand Up @@ -184,7 +184,7 @@ public function setIdGenerator(Closure $id_generator): self
* @param \Galahad\Aire\Elements\Form|null $form
* @return string
*/
public function generateAutoId(Element $element, Form $form = null): string
public function generateAutoId(Element $element, ?Form $form = null): string
{
return (string) call_user_func($this->id_generator, $element, $form);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DTD/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Select extends Element
{
public $name = 'select';

public function __construct(Aire $aire, Form $form = null)
public function __construct(Aire $aire, ?Form $form = null)
{
$this->view_data['options'] = new OptionsCollection();

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Attributes/ClassNames.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ClassNames
* @param string $element_name
* @param \Galahad\Aire\Elements\Element|null $element
*/
public function __construct($element_name, Element $element = null)
public function __construct($element_name, ?Element $element = null)
{
$this->element_name = $element_name;
$this->element = $element;
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Attributes/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Collection implements Htmlable, Arrayable, ArrayAccess
* @param \Galahad\Aire\Elements\Element $element
* @param array|null $default_attributes
*/
public function __construct(Aire $aire, Element $element, array $default_attributes = null)
public function __construct(Aire $aire, Element $element, ?array $default_attributes = null)
{
$this->aire = $aire;
$this->element = $element;
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Checkbox extends Input implements HasJsonValue
*/
protected $bind_value = false;

public function __construct(Aire $aire, Form $form = null)
public function __construct(Aire $aire, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/CheckboxGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CheckboxGroup extends \Galahad\Aire\DTD\Input implements HasJsonValue
'type' => 'checkbox',
];

public function __construct(Aire $aire, $options, Form $form = null)
public function __construct(Aire $aire, $options, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/ClientValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ClientValidation implements Htmlable, NonInput
*/
protected $dev_mode = false;

public function __construct(Aire $aire, $element_id, array $rules = [], array $messages = [], string $form_request = null, $dev_mode = false)
public function __construct(Aire $aire, $element_id, array $rules = [], array $messages = [], ?string $form_request = null, $dev_mode = false)
{
$this->aire = $aire;
$this->element_id = $element_id;
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Concerns/CreatesElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function label(string $label): Label
* @param string|null $label
* @return \Galahad\Aire\Elements\Button
*/
public function button(string $label = null): Button
public function button(?string $label = null): Button
{
$button = new Button($this->aire, $this);

Expand Down
8 changes: 4 additions & 4 deletions src/Elements/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ abstract class Element implements Htmlable
*/
protected $bind_value = true;

public function __construct(Aire $aire, Form $form = null)
public function __construct(Aire $aire, ?Form $form = null)
{
$this->aire = $aire;
$this->element_id = $aire->generateElementId();
Expand Down Expand Up @@ -221,7 +221,7 @@ public function __toString(): string
* @param string|null $key
* @return array|mixed
*/
public function getViewData(string $key = null)
public function getViewData(?string $key = null)
{
if (null === $key) {
return $this->view_data;
Expand All @@ -245,7 +245,7 @@ public function hasViewData(string $key): bool
return Arr::has($this->view_data, $key);
}

public function when($value = null, callable $callback = null, callable $default = null)
public function when($value = null, ?callable $callback = null, ?callable $default = null)
{
$value = $value instanceof Closure
? $value($this)
Expand All @@ -270,7 +270,7 @@ public function when($value = null, callable $callback = null, callable $default
return $this;
}

public function unless($value = null, callable $callback = null, callable $default = null)
public function unless($value = null, ?callable $callback = null, ?callable $default = null)
{
$value = $value instanceof Closure
? $value($this)
Expand Down
6 changes: 3 additions & 3 deletions src/Elements/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Form extends \Galahad\Aire\DTD\Form implements NonInput
*/
protected $on_close;

public function __construct(Aire $aire, UrlGenerator $url, Router $router = null, Store $session_store = null)
public function __construct(Aire $aire, UrlGenerator $url, ?Router $router = null, ?Store $session_store = null)
{
parent::__construct($aire);

Expand Down Expand Up @@ -334,7 +334,7 @@ public function getBoundValue($name, $default = null)
* @param ?string $name
* @return MessageBag|array
*/
public function getErrors(string $name = null)
public function getErrors(?string $name = null)
{
$errors = $this->session_store
->get('errors', new ViewErrorBag())
Expand Down Expand Up @@ -504,7 +504,7 @@ public function multipart(): self
* @param array $custom_messages
* @return $this
*/
public function validate($rule_source = null, array $custom_messages = null): self
public function validate($rule_source = null, ?array $custom_messages = null): self
{
$this->validate = true;

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Input extends \Galahad\Aire\DTD\Input implements HasJsonValue
'type' => 'text',
];

public function __construct(Aire $aire, Form $form = null)
public function __construct(Aire $aire, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Label extends \Galahad\Aire\DTD\Label implements NonInput
*/
public $group;

public function __construct(Aire $aire, Group $group = null)
public function __construct(Aire $aire, ?Group $group = null)
{
$this->group = $group;

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/RadioGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RadioGroup extends \Galahad\Aire\DTD\Input implements HasJsonValue
* @param array|\Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\JsonSerializable|\Traversable $options
* @param \Galahad\Aire\Elements\Form|null $form
*/
public function __construct(Aire $aire, $options, Form $form = null)
public function __construct(Aire $aire, $options, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Select extends \Galahad\Aire\DTD\Select implements HasJsonValue
use AutoId;
use MapsValueToJsonValue;

public function __construct(Aire $aire, $options, Form $form = null)
public function __construct(Aire $aire, $options, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Summary extends Element implements NonInput
'verbose' => false,
];

public function __construct(Aire $aire, Form $form = null)
public function __construct(Aire $aire, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Textarea extends \Galahad\Aire\DTD\Textarea implements HasJsonValue
'auto_size' => false,
];

public function __construct(Aire $aire, Form $form = null)
public function __construct(Aire $aire, ?Form $form = null)
{
parent::__construct($aire, $form);

Expand Down
2 changes: 1 addition & 1 deletion tests/Constraints/SelectorAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SelectorAttribute extends CrawlerConstraint
*/
protected $value;

public function __construct(string $selector, string $attribute, string $value = null)
public function __construct(string $selector, string $attribute, ?string $value = null)
{
$this->selector = $selector;
$this->attribute = $attribute;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function assertSelectorMissingText($html, string $selector, string $te
$this->assertStringNotContainsString($text, trim($actual));
}

protected function assertSelectorAttribute($html, string $selector, string $attribute, string $value = null)
protected function assertSelectorAttribute($html, string $selector, string $attribute, ?string $value = null)
{
static::assertThat($html, new SelectorAttribute($selector, $attribute, $value));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/AutoIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function test_auto_ids_are_incremented(): void

public function test_auto_id_can_be_user_defined(): void
{
$this->aire()->setIdGenerator(function(Element $element, Form $form = null) {
$this->aire()->setIdGenerator(function(Element $element, ?Form $form = null) {
return "foo-{$element->getInputName()}";
});

Expand Down
Loading