Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-GG committed Oct 17, 2024
1 parent c15727e commit 99c474f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
- master
- '*.x'
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
analyse:
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/MagentoCustomerTokenGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function validate(array $credentials = [])
return (bool) $this->retrieveByToken($credentials[$this->inputKey]);
}

protected function retrieveByToken(string $token): Customer
protected function retrieveByToken(string $token): ?Customer
{
return config('rapidez.models.customer')::whereToken($token)->first();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/IndexCategoriesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Rapidez\Core\Commands;

use Illuminate\Support\Collection;
use Illuminate\Database\Eloquent\Collection;
use Rapidez\Core\Facades\Rapidez;
use TorMorten\Eventy\Facades\Eventy;

Expand Down Expand Up @@ -38,6 +38,6 @@ public function getCategories(): Collection
->whereNotNull('url_key')
->whereNot('url_key', 'default-category')
->has('products')
->get() ?? collect();
->get();
}
}
5 changes: 1 addition & 4 deletions src/Http/Controllers/Fallback/UrlRewriteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

namespace Rapidez\Core\Http\Controllers\Fallback;

use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;

class UrlRewriteController
{
public function __invoke(Request $request): Redirector|RedirectResponse|View|null
public function __invoke(Request $request): mixed
{
$rewriteModel = config('rapidez.models.rewrite');
if (! $rewrite = $rewriteModel::firstWhere('request_path', $request->path())) {
Expand Down
4 changes: 1 addition & 3 deletions src/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace Rapidez\Core\Http\Controllers;

use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

class SearchController
{
public function __invoke(Request $request): RedirectResponse|View
public function __invoke(Request $request): mixed
{
$searchQuery = config('rapidez.models.search_query')::firstOrNew([
'query_text' => Str::lower($request->q),
Expand Down
6 changes: 4 additions & 2 deletions src/Listeners/Healthcheck/ModelsHealthcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ public function handle(): array
'messages' => [],
];

/** @var array<string, string> $models */
$models = config('rapidez.models');

/** @var \Illuminate\Support\Collection<string, string> $classesWithIncorrectParent */
// @phpstan-ignore-next-line
$classesWithIncorrectParent = collect(config('rapidez.models'))->filter(fn ($model) => ! is_subclass_of($model, Model::class));
$classesWithIncorrectParent = collect($models)->filter(fn ($model) => ! is_subclass_of($model, Model::class));

if (! $classesWithIncorrectParent->count()) {
return $response;
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function getCachedByPath(string $path, ?string $default = null, bo
return $sensitive && $value ? self::decrypt($value) : $value;
}

public static function decrypt(string $value): string|false
public static function decrypt(string $value): ?string
{
throw_unless(
config('rapidez.crypt_key'),
Expand All @@ -73,6 +73,6 @@ public static function decrypt(string $value): string|false
$nonce,
$nonce,
config('rapidez.crypt_key')
);
) ?: null;
}
}
8 changes: 2 additions & 6 deletions src/Models/Scopes/IsActiveScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@

class IsActiveScope implements Scope
{
public string $column;

public function __construct(string $column = 'is_active')
{
$this->column = $column;
}
public function __construct(public string $column = 'is_active')
{ }

/** @param Builder<Model> $builder */
public function apply(Builder $builder, Model $model)
Expand Down

0 comments on commit 99c474f

Please sign in to comment.