Skip to content

Commit 2c1d879

Browse files
binarykgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 030bbbb commit 2c1d879

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

src/Fields/Field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
class Field extends OrganicField implements JsonSerializable
1919
{
20-
use Make;
21-
use HasAction;
2220
use FieldMcpSchemaDetection;
21+
use HasAction;
22+
use Make;
2323

2424
/**
2525
* The resource associated with the field.

src/Fields/FieldCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function forMcpIndex(RestifyRequest $request, $repository): self
7373
if ($request instanceof McpRequest && method_exists($repository, 'fieldsForMcpIndex')) {
7474
// Get the MCP-specific fields from the repository
7575
$mcpFields = $repository->fieldsForMcpIndex($request);
76-
$mcpFieldAttributes = collect($mcpFields)->map(fn($field) => $field->attribute)->toArray();
77-
76+
$mcpFieldAttributes = collect($mcpFields)->map(fn ($field) => $field->attribute)->toArray();
77+
7878
// Filter the current collection to only include MCP fields
7979
return $this
8080
->filter(fn (Field $field) => ! $field instanceof EagerField)
@@ -83,7 +83,7 @@ public function forMcpIndex(RestifyRequest $request, $repository): self
8383
return $field->isShownOnMcp($request, $repository);
8484
})->values();
8585
}
86-
86+
8787
// Fallback to regular index filtering for non-MCP requests
8888
return $this->forIndex($request, $repository);
8989
}

src/Filters/SearchablesCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct($items = [])
4040
*/
4141
public function fieldNames(): array
4242
{
43-
return $this->filter(fn($item) => is_string($item) && !empty($item))
43+
return $this->filter(fn ($item) => is_string($item) && ! empty($item))
4444
->unique()
4545
->values()
4646
->toArray();
@@ -52,11 +52,11 @@ public function fieldNames(): array
5252
public function formatForDocumentation(): string
5353
{
5454
$fields = $this->fieldNames();
55-
55+
5656
if (empty($fields)) {
5757
return 'No searchable fields available';
5858
}
5959

6060
return implode(', ', $fields);
6161
}
62-
}
62+
}

src/MCP/Concerns/McpTools.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ protected static function getRelationshipFields(string $repositoryClass): array
240240
// This will call fieldsForMcpIndex if available, providing accurate MCP field documentation
241241
$fields = $repository->collectFields($request)
242242
->forMcpIndex($request, $repository)
243-
->map(fn($field) => $field->attribute)
243+
->map(fn ($field) => $field->attribute)
244244
->unique()
245245
->sort()
246246
->values()
@@ -302,9 +302,9 @@ protected static function formatRelationshipDocumentation(): string
302302
$firstFields = static::getRelationshipFields($firstRepositoryClass);
303303
$exampleFields = array_slice($firstFields, 0, 2);
304304

305-
if (!empty($exampleFields)) {
306-
$documentation .= "- include={$firstRelationName}[" . implode(',', $exampleFields) . "] (selective fields with comma syntax)\n";
307-
$documentation .= "- include={$firstRelationName}[" . implode('|', $exampleFields) . "] (selective fields with pipe syntax)\n";
305+
if (! empty($exampleFields)) {
306+
$documentation .= "- include={$firstRelationName}[".implode(',', $exampleFields)."] (selective fields with comma syntax)\n";
307+
$documentation .= "- include={$firstRelationName}[".implode('|', $exampleFields)."] (selective fields with pipe syntax)\n";
308308
}
309309

310310
// Add comprehensive nested relationship examples based on real test cases

src/MCP/Tools/GlobalSearchTool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function description(): string
2525
public function schema(ToolInputSchema $schema): ToolInputSchema
2626
{
2727
$searchableRepositories = collect(Restify::globallySearchableRepositories(app(McpRequest::class)));
28-
$repositoryNames = $searchableRepositories->map(fn($repo) => $repo::uriKey())->implode(', ');
28+
$repositoryNames = $searchableRepositories->map(fn ($repo) => $repo::uriKey())->implode(', ');
2929

3030
$schema->string('search')
3131
->description("Search query to find records across all repositories. Searches through searchable fields in: {$repositoryNames}")
@@ -58,7 +58,7 @@ public function handle(array $arguments): ToolResult|Generator
5858
return ToolResult::json([
5959
'results' => $results,
6060
'total' => count($results),
61-
'searched_repositories' => collect($globallySearchableRepositories)->map(fn($repo) => [
61+
'searched_repositories' => collect($globallySearchableRepositories)->map(fn ($repo) => [
6262
'name' => $repo::uriKey(),
6363
'title' => $repo::label(),
6464
])->values()->toArray(),

tests/Fields/FieldMcpSchemaDetectionTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
namespace Binaryk\LaravelRestify\Tests\Fields;
44

5-
use Binaryk\LaravelRestify\Fields\BelongsTo;
65
use Binaryk\LaravelRestify\Fields\Field;
7-
use Binaryk\LaravelRestify\Fields\File;
8-
use Binaryk\LaravelRestify\Fields\HasMany;
9-
use Binaryk\LaravelRestify\MCP\Concerns\FieldMcpSchemaDetection;
106
use Binaryk\LaravelRestify\Tests\Fixtures\Post\PostRepository;
117
use Binaryk\LaravelRestify\Tests\IntegrationTestCase;
128
use Laravel\Mcp\Server\Tools\ToolInputSchema;
@@ -23,7 +19,7 @@ protected function tearDown(): void
2319
public function test_resolve_tool_schema_with_default_implementation(): void
2420
{
2521
$schema = Mockery::mock(ToolInputSchema::class);
26-
$repository = new PostRepository();
22+
$repository = new PostRepository;
2723

2824
$schema->shouldReceive('string')->with('title')->once()->andReturnSelf();
2925
$schema->shouldReceive('description')->with('Field: title (type: string). Examples: Sample Title, My Title')->once()->andReturnSelf();
@@ -37,7 +33,7 @@ public function test_resolve_tool_schema_with_default_implementation(): void
3733
public function test_resolve_tool_schema_with_required_field(): void
3834
{
3935
$schema = Mockery::mock(ToolInputSchema::class);
40-
$repository = new PostRepository();
36+
$repository = new PostRepository;
4137

4238
$schema->shouldReceive('string')->with('title')->once()->andReturnSelf();
4339
$schema->shouldReceive('description')->once()->andReturnSelf();
@@ -52,7 +48,7 @@ public function test_resolve_tool_schema_with_required_field(): void
5248
public function test_resolve_tool_schema_with_custom_callback(): void
5349
{
5450
$schema = Mockery::mock(ToolInputSchema::class);
55-
$repository = new PostRepository();
51+
$repository = new PostRepository;
5652
$callbackCalled = false;
5753

5854
$field = $this->createTestField('title');

tests/Fields/HasManyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function test_can_display_other_pages(): void
147147
public function test_can_apply_filters(): void
148148
{
149149
$this->markTestSkipped('Skipping filter test for PHP 8.2 + Laravel 11 prefer-lowest compatibility');
150-
150+
151151
tap($u = $this->mockUsers()->first(), function ($user) {
152152
tap($this->mockPosts($user->getKey(), 20), static function (Collection $posts) {
153153
$first = $posts->first();

0 commit comments

Comments
 (0)