Skip to content

Commit

Permalink
Merge branch '3.x' into on-change-with-params
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-to authored Jan 9, 2025
2 parents e411bbd + c393f50 commit 64078d1
Show file tree
Hide file tree
Showing 64 changed files with 350 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.2, 8.3]
php: [8.2, 8.3, 8.4]
laravel: [10, 11]

steps:
Expand Down
44 changes: 44 additions & 0 deletions .meta-storm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<meta-storm xmlns="meta-storm">
<definitions>
<classMethod
class="\MoonShine\Contracts\UI\HasIconContract"
method="icon"
argument="0"
>
<files extension="blade.php" xpath="$project/vendor/moonshine/moonshine/src/UI/resources/views/icons"/>
</classMethod>

<classMethod
class="\MoonShine\UI\Components\ActionButton"
method="method"
argument="0"
>
<methods xpath="$containingClass" private="false" protected="false" static="false" />
</classMethod>

<classMethod
class="\MoonShine\Contracts\UI\FormBuilderContract"
method="asyncMethod"
argument="0"
>
<methods xpath="$containingClass" private="false" protected="false" static="false" />
</classMethod>

<classMethod
class="\MoonShine\Laravel\Fields\Relationships\ModelRelationField"
method="make"
argument="1"
>
<methods xpath="$containingClass.$model" />
</classMethod>

<classMethod
class="\MoonShine\Contracts\UI\FieldContract"
method="make"
argument="1"
>
<arrayValues xpath="$containingClass.$model.$fillable" />
</classMethod>
</definitions>
</meta-storm>
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
->setRules([
'@PSR12' => true,
'native_function_invocation' => true,
'nullable_type_declaration_for_default_null_value' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
Expand Down
80 changes: 0 additions & 80 deletions ide.json

This file was deleted.

2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
$rectorConfig->importShortClasses();
$rectorConfig->removeUnusedImports();

$rectorConfig->rule(Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector::class);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
Expand Down
8 changes: 4 additions & 4 deletions src/Contracts/src/Core/CrudResourceContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
interface CrudResourceContract extends ResourceContract
{
public function getRoute(
string $name = null,
?string $name = null,
DataWrapperContract|int|string|null $key = null,
array $query = []
): string;
Expand Down Expand Up @@ -120,15 +120,15 @@ public function delete(mixed $item, ?FieldsContract $fields = null): bool;
public function save(mixed $item, ?FieldsContract $fields = null): mixed;


public function getIndexPageUrl(array $params = [], ?string $fragment = null): string;
public function getIndexPageUrl(array $params = [], null|string|array $fragment = null): string;

/**
* @param DataWrapperContract<TData>|int|string|null $key
*/
public function getFormPageUrl(
DataWrapperContract|int|string|null $key = null,
array $params = [],
?string $fragment = null
null|string|array $fragment = null
): string;

/**
Expand All @@ -137,7 +137,7 @@ public function getFormPageUrl(
public function getDetailPageUrl(
DataWrapperContract|int|string $key,
array $params = [],
?string $fragment = null
null|string|array $fragment = null
): string;

public function setQueryParams(iterable $params): static;
Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/src/Core/DependencyInjection/FieldsContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function whenFieldsConditions(): static;
*/
public function findByColumn(
string $column,
FieldContract $default = null
?FieldContract $default = null
): ?FieldContract;

/**
Expand All @@ -69,7 +69,7 @@ public function findByColumn(
*/
public function findByClass(
string $class,
FieldContract $default = null
?FieldContract $default = null
): ?FieldContract;

public function wrapNames(string $name): static;
Expand Down
6 changes: 3 additions & 3 deletions src/Contracts/src/Core/PagesContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface PagesContract extends Enumerable
*/
public function findByType(
PageType $type,
PageContract $default = null
?PageContract $default = null
): ?PageContract;

/**
Expand All @@ -37,7 +37,7 @@ public function findByType(
*/
public function findByClass(
string $class,
PageContract $default = null
?PageContract $default = null
): ?PageContract;

/**
Expand All @@ -46,7 +46,7 @@ public function findByClass(
*/
public function findByUri(
string $uri,
PageContract $default = null
?PageContract $default = null
): ?PageContract;

public function activePage(): ?PageContract;
Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/src/Core/ResourcesContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface ResourcesContract extends Enumerable
*/
public function findByUri(
string $uri,
ResourceContract $default = null
?ResourceContract $default = null
): ?ResourceContract;

/**
Expand All @@ -35,6 +35,6 @@ public function findByUri(
*/
public function findByClass(
string $class,
ResourceContract $default = null
?ResourceContract $default = null
): ?ResourceContract;
}
4 changes: 2 additions & 2 deletions src/Contracts/src/UI/ActionButtonContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function method(
string $method,
array|Closure $params = [],
?string $message = null,
?string $selector = null,
null|string|array $selector = null,
array $events = [],
?AsyncCallback $callback = null,
?PageContract $page = null,
Expand All @@ -83,7 +83,7 @@ public function dispatchEvent(array|string $events): static;

public function async(
HttpMethod $method = HttpMethod::GET,
?string $selector = null,
null|string|array $selector = null,
array $events = [],
?AsyncCallback $callback = null
): static;
Expand Down
6 changes: 3 additions & 3 deletions src/Contracts/src/UI/Collection/ComponentsContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public function onlyComponents(): static;

public function findForm(
string $name,
FormBuilderContract $default = null
?FormBuilderContract $default = null
): ?FormBuilderContract;

public function findTable(
string $name,
TableBuilderContract $default = null
?TableBuilderContract $default = null
): ?TableBuilderContract;

public function findByName(
string $name,
ComponentContract $default = null
?ComponentContract $default = null
): ?ComponentContract;
}
4 changes: 2 additions & 2 deletions src/Contracts/src/UI/FieldContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function onChangeMethod(
string $method,
array|Closure $params = [],
?string $message = null,
?string $selector = null,
null|string|array $selector = null,
array $events = [],
?AsyncCallback $callback = null,
?PageContract $page = null,
Expand All @@ -79,7 +79,7 @@ public function onChangeUrl(
Closure $url,
HttpMethod $method = HttpMethod::GET,
array $events = [],
?string $selector = null,
null|string|array $selector = null,
?AsyncCallback $callback = null,
): static;

Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/src/UI/FormElementContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function setParent(FormElementContract $field): static;

public function formName(?string $formName = null): static;

public function getIdentity(string $index = null): string;
public function getIdentity(?string $index = null): string;

public function getFormName(): ?string;

Expand Down Expand Up @@ -69,7 +69,7 @@ public function getDefaultIfExists(): mixed;

public function getRowIndex(): int;

public function getNameAttribute(string $index = null): string;
public function getNameAttribute(?string $index = null): string;

public function customWrapperAttributes(array $attributes): static;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface HasQuickFormElementAttributesContract
{
public function setNameAttribute(string $name): static;

public function getNameAttribute(string $index = null): string;
public function getNameAttribute(?string $index = null): string;

public function wrapName(string $wrapName): static;

Expand Down
6 changes: 3 additions & 3 deletions src/Core/src/Collections/Components.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function onlyFields(bool $withWrappers = false): FieldsContract
*/
public function findForm(
string $name,
FormBuilderContract $default = null
?FormBuilderContract $default = null
): ?FormBuilderContract {
return $this->onlyForms()->first(
static fn (FormBuilderContract $component): bool => $component->getName() === $name,
Expand All @@ -113,7 +113,7 @@ public function findForm(
*/
public function findTable(
string $name,
TableBuilderContract $default = null
?TableBuilderContract $default = null
): ?TableBuilderContract {
return $this->onlyTables()->first(
static fn (TableBuilderContract $component): bool => $component->getName() === $name,
Expand All @@ -126,7 +126,7 @@ public function findTable(
*/
public function findByName(
string $name,
ComponentContract $default = null
?ComponentContract $default = null
): ?ComponentContract {
return $this->onlyComponents()->first(
static fn (ComponentContract $component): bool => $component->getName() === $name,
Expand Down
6 changes: 3 additions & 3 deletions src/Core/src/Pages/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public function setResource(ResourceContract $resource): Pages

public function findByType(
PageType $type,
PageContract $default = null
?PageContract $default = null
): ?PageContract {
return $this->first(static fn (PageContract $page): bool => $page->getPageType() === $type, $default);
}

public function findByClass(
string $class,
PageContract $default = null
?PageContract $default = null
): ?PageContract {
return $this->first(
static fn (PageContract $page): bool => $page::class === $class,
Expand Down Expand Up @@ -61,7 +61,7 @@ public function activePage(): ?PageContract

public function findByUri(
string $uri,
PageContract $default = null
?PageContract $default = null
): ?PageContract {
return $this->first(
static function (PageContract $page) use ($uri): bool {
Expand Down
Loading

0 comments on commit 64078d1

Please sign in to comment.