Compare commits

..

2 commits

Author SHA1 Message Date
Claude
ddfb71d767
refactor: add declare(strict_types=1) to remaining PHP files
Add strict_types declaration to 9 scaffold/config files that were
missed in the earlier dx-audit pass (bcb40d4). All non-blade PHP
files in the repository now enforce strict typing per CLAUDE.md
conventions.

Files: bootstrap/app.php, bootstrap/providers.php, config/core.php,
database/seeders/DatabaseSeeder.php, public/index.php, routes/*.php,
app/Providers/AppServiceProvider.php

Fixes #5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:38:18 +00:00
Claude
9f7e5783ba
fix: add error handling to SearchProviderRegistry search method
Wrap individual provider search calls in try-catch so a single
provider failure no longer breaks the entire search. Failures are
logged as warnings and the remaining providers continue normally.

Fixes #11

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:37:21 +00:00
10 changed files with 66 additions and 37 deletions

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
return [
App\Providers\AppServiceProvider::class,
];

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
return [
/*
|--------------------------------------------------------------------------

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Database\Seeders;
use Illuminate\Database\Seeder;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
// API routes are registered via Core modules

View file

@ -1,3 +1,5 @@
<?php
declare(strict_types=1);
// Console commands are registered via Core modules

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
Route::get('/', function () {

View file

@ -13,6 +13,7 @@ namespace Core\Admin\Search;
use Core\Admin\Search\Contracts\SearchProvider;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
/**
@ -111,46 +112,56 @@ class SearchProviderRegistry
$grouped = [];
foreach ($this->availableProviders($user, $workspace) as $provider) {
$type = $provider->searchType();
$results = $provider->search($query, $limitPerProvider);
try {
$type = $provider->searchType();
$results = $provider->search($query, $limitPerProvider);
// Convert results to array format with type/icon
$formattedResults = $results->map(function ($result) use ($provider) {
if ($result instanceof SearchResult) {
return $result->withTypeAndIcon(
$provider->searchType(),
$provider->searchIcon()
)->toArray();
// Convert results to array format with type/icon
$formattedResults = $results->map(function ($result) use ($provider) {
if ($result instanceof SearchResult) {
return $result->withTypeAndIcon(
$provider->searchType(),
$provider->searchIcon()
)->toArray();
}
// Handle array results
if (is_array($result)) {
$searchResult = SearchResult::fromArray($result);
return $searchResult->withTypeAndIcon(
$provider->searchType(),
$provider->searchIcon()
)->toArray();
}
// Handle model objects with getUrl
return [
'id' => (string) ($result->id ?? uniqid()),
'title' => (string) ($result->title ?? $result->name ?? ''),
'subtitle' => (string) ($result->subtitle ?? $result->description ?? ''),
'url' => $provider->getUrl($result),
'type' => $provider->searchType(),
'icon' => $provider->searchIcon(),
'meta' => [],
];
})->toArray();
if (! empty($formattedResults)) {
$grouped[$type] = [
'label' => $provider->searchLabel(),
'icon' => $provider->searchIcon(),
'results' => $formattedResults,
];
}
} catch (\Throwable $e) {
Log::warning('Search provider failed', [
'provider' => $provider::class,
'query' => $query,
'error' => $e->getMessage(),
]);
// Handle array results
if (is_array($result)) {
$searchResult = SearchResult::fromArray($result);
return $searchResult->withTypeAndIcon(
$provider->searchType(),
$provider->searchIcon()
)->toArray();
}
// Handle model objects with getUrl
return [
'id' => (string) ($result->id ?? uniqid()),
'title' => (string) ($result->title ?? $result->name ?? ''),
'subtitle' => (string) ($result->subtitle ?? $result->description ?? ''),
'url' => $provider->getUrl($result),
'type' => $provider->searchType(),
'icon' => $provider->searchIcon(),
'meta' => [],
];
})->toArray();
if (! empty($formattedResults)) {
$grouped[$type] = [
'label' => $provider->searchLabel(),
'icon' => $provider->searchIcon(),
'results' => $formattedResults,
];
continue;
}
}