Skip to content

Commit

Permalink
Increment pslam error level
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Dec 30, 2024
1 parent 8f557c4 commit 54ac73e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 28 deletions.
3 changes: 2 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<psalm
phpVersion="8.1"
errorLevel="7"
errorLevel="5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -18,6 +18,7 @@
</ignoreFiles>
</projectFiles>
<issueHandlers>
<UndefinedMagicMethod errorLevel="suppress" />
<MissingTemplateParam errorLevel="suppress" />
<UndefinedClass>
<errorLevel type="suppress">
Expand Down
4 changes: 1 addition & 3 deletions src/Attachment/Models/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace Orchid\Attachment\Models;

use Exception;
use Illuminate\Contracts\Filesystem\Cloud;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
Expand Down Expand Up @@ -106,7 +104,7 @@ public function user(): BelongsTo
*/
public function url(?string $default = null): ?string
{
/** @var Filesystem|Cloud $disk */
/** @var \Illuminate\Filesystem\FilesystemAdapter $disk */
$disk = Storage::disk($this->getAttribute('disk'));
$path = $this->physicalPath();

Expand Down
6 changes: 3 additions & 3 deletions src/Filters/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract public function run(Builder $builder): Builder;
/**
* Get the display fields.
*
* @return Fieldable[]
* @return iterable<Fieldable>
*/
public function display(): iterable
{
Expand All @@ -87,7 +87,7 @@ public function name(): string

public function render(): string
{
$fields = collect($this->display())->map(fn (Fieldable $field) => $field->form('filters'));
$fields = collect($this->display())->map(fn (Fieldable $field) => $field->set('form', 'filters'));
$params = $this->query();

$builder = new \Orchid\Screen\Builder($fields, new Repository($params));
Expand All @@ -100,7 +100,7 @@ public function render(): string
*/
public function count(): int
{
return count($this->display());
return collect($this->display())->count();
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/Platform/Http/Screens/SearchScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class SearchScreen extends Screen
{
public const SESSION_NAME = 'orchid_search_type';

/**
* @var string
*/
protected $description = '';

/**
* Display header name.
*/
Expand Down
36 changes: 23 additions & 13 deletions src/Platform/Providers/FoundationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,33 @@ public function register(): void

$this->app->singleton(Dashboard::class, static fn () => new Dashboard);

if (! Route::hasMacro('screen')) {
Route::macro('screen', function ($url, $screen) {
/* @var Router $this */
$route = $this->match(['GET', 'HEAD', 'POST'], $url.'/{method?}', $screen);
$this
->registerScreenMacro()
->mergeConfigFrom(
Dashboard::path('config/platform.php'), 'platform'
);

$route->where('method', $screen::getAvailableMethods()->implode('|'));
Blade::component('orchid-popover', Popover::class);
Blade::component('orchid-notification', Notification::class);
Blade::component('orchid-stream', Stream::class);
}

return $route;
});
/**
* Register the 'screen' route macro.
*/
protected function registerScreenMacro(): self
{
if (Route::hasMacro('screen')) {
return $this;
}

$this->mergeConfigFrom(
Dashboard::path('config/platform.php'), 'platform'
);
$macro = function (string $url, string $screen) {
return Route::match(['GET', 'HEAD', 'POST'], $url . '/{method?}', $screen)
->where('method', $screen::getAvailableMethods()->implode('|'));
};

Blade::component('orchid-popover', Popover::class);
Blade::component('orchid-notification', Notification::class);
Blade::component('orchid-stream', Stream::class);
Route::macro('screen', $macro);

return $this;
}
}
6 changes: 5 additions & 1 deletion src/Screen/Layouts/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function build(Repository $repository): string

public function __toString(): string
{
return (string) $this->render($this->target);
if (method_exists($this, 'render')) {
return (string) $this->render($this->target);
}

throw new \RuntimeException('Method render not found');
}
}
4 changes: 2 additions & 2 deletions src/Screen/Layouts/Rows.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function title(?string $title = null): self
}

/**
* @return Field[]
*/
* @return iterable<Field>|iterable<string>
*/
abstract protected function fields(): iterable;
}
8 changes: 3 additions & 5 deletions src/Screen/Screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Route;
use Orchid\Platform\Http\Controllers\Controller;
use Orchid\Screen\Layouts\Listener;
use Orchid\Support\Facades\Dashboard;

/**
Expand Down Expand Up @@ -90,7 +91,7 @@ public function commandBar()
/**
* The layout for this screen, consisting of a collection of views.
*
* @return Layout[]
* @return iterable<\Orchid\Screen\Layout>|iterable<string>
*/
abstract public function layout(): iterable;

Expand Down Expand Up @@ -156,7 +157,7 @@ public function asyncBuild(string $method, string $slug)
*
* @return \Illuminate\Http\Response
*/
public function asyncParticalLayout(Layout $layout, Request $request)
public function asyncParticalLayout(Listener $layout, Request $request): Response
{
Dashboard::setCurrentScreen($this, true);

Expand Down Expand Up @@ -291,9 +292,6 @@ public static function unaccessed()
}

/**
* @param \Illuminate\Http\Request $request
* @param ...$arguments
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
Expand Down

0 comments on commit 54ac73e

Please sign in to comment.