Skip to content

Commit

Permalink
Added shortcut for null
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaplet committed Apr 22, 2024
1 parent 5d004ad commit 9d99fd5
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 32 deletions.
6 changes: 2 additions & 4 deletions src/Collection/WriteBuilder/Rule/AnyOfRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
class AnyOfRule extends BaseRule
{
/**
* AnyOfRule constructor.
* @param array<int, string|int|float|bool|null> $keys
* @param string|null $message
*/
public function __construct(
protected array $keys,
protected string|null $message = null
protected array $keys,
protected ?string $message = null
)
{
parent::__construct(message: $message);
Expand Down
2 changes: 1 addition & 1 deletion src/Collection/WriteBuilder/Rule/Base/BaseRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class BaseRule implements IRule
/** @var IRule[] */
protected array $relatedRules = [];

public function __construct(protected string|null $message = null)
public function __construct(protected ?string $message = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Collection/WriteBuilder/Rule/CallableRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CallableRule extends BaseRule

public function __construct(
callable $callback,
protected string|null $message = null,
protected ?string $message = null,
)
{
$this->callback = [$callback];
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/WriteBuilder/Rule/EqualRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class EqualRule extends BaseRule
{
public function __construct(
protected string $targetField,
protected string|null $message = null
protected string $targetField,
protected ?string $message = null
)
{
parent::__construct(message: $message);
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/WriteBuilder/Rule/HourMinuteRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class HourMinuteRule extends BaseRule
{
public function __construct(
protected string|null $message = null,
protected bool $normalize = true
protected ?string $message = null,
protected bool $normalize = true
)
{
parent::__construct(message: $message);
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/WriteBuilder/Rule/MaxRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class MaxRule extends BaseRule
{
public function __construct(
protected int $max,
protected string|null $message = null
protected int $max,
protected ?string $message = null
)
{
parent::__construct(message: $message);
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/WriteBuilder/Rule/MinRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class MinRule extends BaseRule
{
public function __construct(
protected int $min,
protected string|null $message = null
protected int $min,
protected ?string $message = null
)
{
parent::__construct(message: $message);
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/WriteBuilder/Rule/PhoneCzRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class PhoneCzRule extends BaseRule
{
public function __construct(
protected string|null $message = null,
protected bool $normalize = true
protected ?string $message = null,
protected bool $normalize = true
)
{
parent::__construct(message: $message);
Expand Down
8 changes: 2 additions & 6 deletions src/Collection/WriteBuilder/Rule/RegexRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@

class RegexRule extends BaseRule
{
/**
* @param string $expression
* @param string|null $message
*/
public function __construct(
protected string $expression,
protected string|null $message = null
protected string $expression,
protected ?string $message = null
)
{
parent::__construct(message: $message);
Expand Down
11 changes: 4 additions & 7 deletions src/Collection/WriteBuilder/Rule/UniqueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ class UniqueRule extends BaseRule
{
/**
* @param class-string $targetEntity
* @param string $columnName
* @param string $primaryKey
* @param string|null $message
*/
public function __construct(
protected string $targetEntity,
protected string $columnName,
protected string $primaryKey = 'id',
protected string|null $message = null
protected string $targetEntity,
protected string $columnName,
protected string $primaryKey = 'id',
protected ?string $message = null
)
{
parent::__construct(message: $message);
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/WriteBuilder/Rule/VideoLinkRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class VideoLinkRule extends BaseRule
{
public function __construct(
protected string|null $message = null,
protected bool $normalize = true
protected ?string $message = null,
protected bool $normalize = true
)
{
parent::__construct(message: $message);
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Request/Resource/ReadAllRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private function sortCollectionDataResources(array $resources): array
return $resources;
}

private function createHint(ResourceType $type, string $name): string|null
private function createHint(ResourceType $type, string $name): ?string
{
if ($type === ResourceType::VUE_ROUTER) {
return null;
Expand Down

0 comments on commit 9d99fd5

Please sign in to comment.