Skip to content

Commit

Permalink
🚨 Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
siguici committed Apr 17, 2024
1 parent 2064552 commit 9824fe4
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/ComponentCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function compileClosingTags(string $value): string
/**
* @param array<mixed> $attributes
*/
protected function componentString(string $component, array $attributes, string $contents = null): string
protected function componentString(string $component, array $attributes, ?string $contents = null): string
{
if ($info = Facade::find($component)) {
['class' => $class, 'alias' => $alias] = $info;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Button extends FormControl
*/
public function __construct(
string $type = 'button',
string $href = null,
string $route = null,
?string $href = null,
?string $route = null,
string|array $parameters = [],
public ?string $name = null,
public ?string $value = null,
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Entry extends FormControl

public function __construct(
string $type = 'text',
string $name = null,
string $id = null,
?string $name = null,
?string $id = null,
bool|string $autocomplete = false,
public array $datalist = [],
public ?string $icon = null,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Flash.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Flash extends Component

public function __construct(
string $type,
string $message = null,
?string $message = null,
public string $tag = 'p',
public ?string $icon = null,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Form extends Component
public function __construct(
string $method = 'GET',
string $action = '#',
string $route = null,
?string $route = null,
string|array $parameters = [],
public bool $hasFiles = false,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Icon extends Component

public function __construct(
string $name,
string $root = null,
?string $root = null,
int $size = 24,
string $type = 'solid',
string $tag = 'svg',
Expand Down
10 changes: 5 additions & 5 deletions src/Components/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Input extends FormControl

public function __construct(
string $type = 'text',
string $name = null,
string $id = null,
string|array $value = null,
string $current = null,
string $default = null,
?string $name = null,
?string $id = null,
string|array|null $value = null,
?string $current = null,
?string $default = null,
public bool $invalid = false,
public ?string $icon = null,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Link extends Component
*/
public function __construct(
string $href = '#',
string $route = null,
?string $route = null,
string|array $parameters = [],
public ?string $text = null,
public ?string $icon = null,
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class Select extends FormControl

public function __construct(
string $name,
string $id = null,
string|array $value = null,
string $current = null,
string $default = null,
?string $id = null,
string|array|null $value = null,
?string $current = null,
?string $default = null,
public array $options = [],
public bool $invalid = false,
) {
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class Textarea extends FormControl

public function __construct(
string $name,
string $id = null,
string|array $value = null,
string $current = null,
string $default = null,
?string $id = null,
string|array|null $value = null,
?string $current = null,
?string $default = null,
public bool $invalid = false,
public ?string $icon = null,
) {
Expand Down
14 changes: 7 additions & 7 deletions src/Contracts/IsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public function getComponentVariants(string $component, array $default): array;

public function prefix(): string;

public function component(string $class, string $alias = null, bool $anonymous = false): void;
public function component(string $class, ?string $alias = null, bool $anonymous = false): void;

/**
* @param array<string> $classes
*/
public function components(array $classes = [], bool $anonymous = false): void;

public function getAlias(string $class, string $namespace = null): string;
public function getAlias(string $class, ?string $namespace = null): string;

/**
* @return array{namespace:string,class:string,alias:string,options:IsComponentConfig}|null
Expand All @@ -75,12 +75,12 @@ public function find(string $component): ?array;
/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function make(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot $slot = null): string;
public function make(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $slot = null): string;

/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function openTag(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot $contents = null): string;
public function openTag(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $contents = null): string;

/**
* @throws RuntimeException If there is no open tag
Expand All @@ -91,7 +91,7 @@ public function closeTag(): string;
* @param Arrayable<int|string,mixed>|mixed[] $contentData
* @param Arrayable<int|string,mixed>|mixed[] $layoutData
*/
public function page(string $contentPath, Arrayable|array $contentData = [], string $layoutPath = null, Arrayable|array $layoutData = [], array $mergeData = []): ViewContract;
public function page(string $contentPath, Arrayable|array $contentData = [], ?string $layoutPath = null, Arrayable|array $layoutData = [], array $mergeData = []): ViewContract;

/**
* @param mixed[] $data
Expand All @@ -103,12 +103,12 @@ public function compress(string $code): string;
/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function makeComponentTag(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot $contents = null): IsComponentTag;
public function makeComponentTag(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $contents = null): IsComponentTag;

/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function makeComponentSlot(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot $contents = null): ComponentSlot;
public function makeComponentSlot(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $contents = null): ComponentSlot;

/**
* @param array<string,string>|ComponentAttributes $attributes
Expand Down
14 changes: 7 additions & 7 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function prefix(): string
return $this->config('prefix', 'ui');
}

public function component(string $class, string $alias = null, bool $anonymous = false): void
public function component(string $class, ?string $alias = null, bool $anonymous = false): void
{
$alias ??= $anonymous ? $class : $this->getAlias($class);
if (is_null($this->find($alias))) {
Expand Down Expand Up @@ -169,7 +169,7 @@ public function components(array $classes = [], bool $anonymous = false): void
}
}

public function getAlias(string $class, string $namespace = null): string
public function getAlias(string $class, ?string $namespace = null): string
{
$namespace ??= self::COMPONENT_NAMESPACE;
if (! str_ends_with($namespace, '\\')) {
Expand Down Expand Up @@ -204,7 +204,7 @@ public function find(string $component): ?array
/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function make(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot $slot = null): string
public function make(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $slot = null): string
{
if ($component = $this->find($name)) {
['alias' => $alias] = $component;
Expand All @@ -224,7 +224,7 @@ public function make(string $name, array|ComponentAttributes $attributes = [], s
/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function openTag(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot $contents = null): string
public function openTag(string $name, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $contents = null): string
{
$tag = $this->makeComponentTag($name, $attributes, $contents);

Expand Down Expand Up @@ -253,7 +253,7 @@ public function closeTag(): string
* @param Arrayable<int|string,mixed>|mixed[] $contentData
* @param Arrayable<int|string,mixed>|mixed[] $layoutData
*/
public function page(string $contentPath, Arrayable|array $contentData = [], string $layoutPath = null, Arrayable|array $layoutData = [], array $mergeData = []): ViewContract
public function page(string $contentPath, Arrayable|array $contentData = [], ?string $layoutPath = null, Arrayable|array $layoutData = [], array $mergeData = []): ViewContract
{
if (isset($layoutPath)) {
$content = ViewFacade::make("contents.$contentPath", $contentData, $mergeData)->render();
Expand Down Expand Up @@ -303,7 +303,7 @@ public function compress(string $code): string
/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function makeComponentTag(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot $contents = null): IsComponentTag
public function makeComponentTag(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $contents = null): IsComponentTag
{
$tag = $this->getComponentTag($component, $component);

Expand All @@ -315,7 +315,7 @@ public function makeComponentTag(string $component, array|ComponentAttributes $a
/**
* @param array<string,string>|ComponentAttributes $attributes
*/
public function makeComponentSlot(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot $contents = null): ComponentSlot
public function makeComponentSlot(string $component, array|ComponentAttributes $attributes = [], string|ComponentSlot|null $contents = null): ComponentSlot
{
$attributes = $this->makeComponentAttributes($component, $attributes);

Expand Down
6 changes: 3 additions & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function registerPublishables(): void
/**
* @param string[]|null $groups
*/
protected function publishesToGroups(array $paths, array $groups = null): void
protected function publishesToGroups(array $paths, ?array $groups = null): void
{
if (is_null($groups)) {
$this->publishes($paths);
Expand Down Expand Up @@ -170,15 +170,15 @@ protected function registerComponentFile(string $file, string $base, bool $anony
}
}

protected function registerComponent(string $class, string $alias = null, bool $anonymous = false): void
protected function registerComponent(string $class, ?string $alias = null, bool $anonymous = false): void
{
Facade::component($class, $alias, $anonymous);
}

/**
* @param string[] $aliases
*/
protected function registerComponentAliases(string $class, array $aliases = [], string $suffix = null): void
protected function registerComponentAliases(string $class, array $aliases = [], ?string $suffix = null): void
{
foreach ($aliases as $alias) {
$this->registerComponent($class, is_null($suffix) ? $alias : "$alias-$suffix");
Expand Down
10 changes: 5 additions & 5 deletions src/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Sikessem\UI\Manager;

if (! function_exists('sikessem_ui_path')) {
function sikessem_ui_path(string $path = null): string
function sikessem_ui_path(?string $path = null): string
{
$path = dirname(__DIR__).DIRECTORY_SEPARATOR.($path ?: '');

Expand All @@ -19,7 +19,7 @@ function sikessem_ui_path(string $path = null): string
}

if (! function_exists('sikessem_config_path')) {
function sikessem_config_path(string $path = null): string
function sikessem_config_path(?string $path = null): string
{
$path = config_path(rtrim('sikessem/'.($path ?: ''), '/'));

Expand All @@ -28,7 +28,7 @@ function sikessem_config_path(string $path = null): string
}

if (! function_exists('sikessem_lang_path')) {
function sikessem_lang_path(string $path = null): string
function sikessem_lang_path(?string $path = null): string
{
$path = lang_path(rtrim('sikessem/'.($path ?: ''), '/'));

Expand All @@ -37,7 +37,7 @@ function sikessem_lang_path(string $path = null): string
}

if (! function_exists('sikessem_resource_path')) {
function sikessem_resource_path(string $path = null): string
function sikessem_resource_path(?string $path = null): string
{
$path = resource_path(rtrim('views/vendor/sikessem/'.($path ?: ''), '/'));

Expand Down Expand Up @@ -74,7 +74,7 @@ function render(string $template, array $data = [], bool $deleteCachedView = fal
* @param Arrayable<int|string,mixed>|mixed[] $contentData
* @param Arrayable<int|string,mixed>|mixed[] $layoutData
*/
function page(string $contentPath, Arrayable|array $contentData = [], string $layoutPath = null, Arrayable|array $layoutData = [], array $mergeData = []): ViewContract
function page(string $contentPath, Arrayable|array $contentData = [], ?string $layoutPath = null, Arrayable|array $layoutData = [], array $mergeData = []): ViewContract
{
return ui()->page($contentPath, $contentData, $layoutPath, $layoutData, $mergeData);
}
Expand Down

0 comments on commit 9824fe4

Please sign in to comment.