Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jul 12, 2024
1 parent 571c614 commit 6a31662
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/Nova/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public static function indexQuery(NovaRequest $request, $query)
* Build a "detail" query for the given resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
* @param \Illuminate\Contracts\Database\Eloquent\Builder $query
* @return \Illuminate\Contracts\Database\Eloquent\Builder
*/
public static function detailQuery(NovaRequest $request, $query)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Nova/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function fields(NovaRequest $request): array
'active' => 'success',
])->label(function ($value) {
return Str::title($value);
})->filterable(function ($request, $query, $value) {
})->filterable(function ($request, $query, $value) { // @phpstan-ignore argument.type
return $query->when($value === 'active', function ($query) {
$query->whereNotNull('email_verified_at');
})->when($value === 'inactive', function ($query) {
Expand Down
5 changes: 1 addition & 4 deletions app/Providers/NovaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function ($command) {
new Prompts\ConfirmPrompt(label: 'Active', default: false, required: true),
];
},
function (string $name, string $email, string $password, bool $active) {
function (string $name, string $email, string $password, bool $active) { // @phpstan-ignore argument.type
/** @var class-string<\Illuminate\Database\Eloquent\Model> $model */
$model = Util::userModel();

Expand Down Expand Up @@ -199,7 +199,6 @@ public function registerActionMacros()
public function registerFieldMacros()
{
Hidden::macro('trackSelectedResources', function (string $from) {
/** @phpstan-ignore-next-line */
$this->dependsOn($from, function (Hidden $field, NovaRequest $request, FormData $formData) use ($from) {
$bool = $formData->get($from, false) === true ? 'true' : 'false';

Expand All @@ -219,12 +218,10 @@ public function registerFieldMacros()
});

Field::macro('showWhen', function (bool $condition) {
/** @phpstan-ignore-next-line */
return $condition === true ? $this->show() : $this->hide();
});

Field::macro('showUnless', function (bool $condition) {
/** @phpstan-ignore-next-line */
return $condition === true ? $this->hide() : $this->show();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle(Filesystem $files)
})
->collect()
->reject(fn ($file) => Str::endsWith($file, 'd.ts') || Str::endsWith($file, ['index.js', 'package.json']))
->transform(function ($file) use ($directory) {
->transform(function ($file) use ($directory) { // @phpstan-ignore argument.type
/** @var string $file */
return Str::snake(
str_replace(['Icon.js', '/'], ['', ''], Str::after($file, $directory)), '-'
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ parameters:
message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\Collection\\<string,Symfony\\\\Component\\\\Finder\\\\SplFileInfo\\>\\:\\:transform\\(\\) expects callable\\(Symfony\\\\Component\\\\Finder\\\\SplFileInfo, string\\)\\: Symfony\\\\Component\\\\Finder\\\\SplFileInfo, Closure\\(mixed\\)\\: string given\\.$#"
count: 1
path: nova-components/IconsViewer/src/Http/Controllers/ViewerController.php

-
message: "#^Strict comparison using \\=\\=\\= between Symfony\\\\Component\\\\Finder\\\\SplFileInfo and 'index\\.js' will always evaluate to false\\.$#"
count: 1
path: nova-components/IconsViewer/src/Http/Controllers/ViewerController.php
6 changes: 3 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ parameters:
- nova-components/SidebarTool/src

# The level 9 is the highest level
level: 6
level: 5

ignoreErrors:
# - identifier: missingType.generics
# - identifier: missingType.iterableValue
- '#Access to an undefined property Laravel\\Nova\\Fields\\(ActionFields|FormData)#'
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\[a-zA-Z\\\<\>]+::(withTrashed|onlyTrashed|trashed)\(\)#'

excludePaths:
- app/Http/Controllers/Auth/*.php

checkMissingIterableValueType: false
noUnnecessaryCollectionCall: false
checkModelProperties: false
checkGenericClassInNonGenericObjectType: false

0 comments on commit 6a31662

Please sign in to comment.