Skip to content

Commit 73553ef

Browse files
klapaudiusgithub-actions[bot]
authored andcommitted
Fix styling
1 parent efa63e3 commit 73553ef

File tree

5 files changed

+39
-42
lines changed

5 files changed

+39
-42
lines changed

src/Services/ToolService/Examples/SearchResultsTool.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function getOutputSchema(): ?StructuredSchema
5858
'title' => ['type' => 'string'],
5959
'url' => ['type' => 'string'],
6060
'snippet' => ['type' => 'string'],
61-
'score' => ['type' => 'number']
61+
'score' => ['type' => 'number'],
6262
],
6363
['id', 'title'], // id and title are required
6464
'Array of search results'
@@ -70,7 +70,7 @@ public function getOutputSchema(): ?StructuredSchema
7070
[
7171
'totalResults' => ['type' => 'integer'],
7272
'searchTime' => ['type' => 'number'],
73-
'query' => ['type' => 'string']
73+
'query' => ['type' => 'string'],
7474
],
7575
['totalResults', 'query'],
7676
'Search metadata'
@@ -98,7 +98,7 @@ public function execute(array $arguments): ToolResultInterface
9898
'title' => "Search Result $i for: $query",
9999
'url' => "https://example.com/result/$i",
100100
'snippet' => "This is a snippet for result $i matching your search query.",
101-
'score' => 1.0 - ($i * 0.1)
101+
'score' => 1.0 - ($i * 0.1),
102102
];
103103
}
104104

@@ -107,20 +107,20 @@ public function execute(array $arguments): ToolResultInterface
107107
'metadata' => [
108108
'totalResults' => count($results),
109109
'searchTime' => 0.125,
110-
'query' => $query
110+
'query' => $query,
111111
],
112112
'suggestions' => [
113113
"$query tips",
114114
"$query tutorial",
115-
"$query examples"
116-
]
115+
"$query examples",
116+
],
117117
];
118118

119119
return new TextToolResult(json_encode($response, JSON_PRETTY_PRINT));
120120
}
121121

122122
public function getAnnotations(): ToolAnnotation
123123
{
124-
return new ToolAnnotation();
124+
return new ToolAnnotation;
125125
}
126126
}

src/Services/ToolService/Schema/SchemaBuilder.php

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ class SchemaBuilder
2222
* ], ['id', 'title'])
2323
* ```
2424
*
25-
* @param string $name Property name
26-
* @param array<string, mixed> $objectProperties Properties of objects in the array
27-
* @param array<string> $requiredProperties Required properties in each object
28-
* @param string $description Property description
29-
* @param bool $required Whether the array property itself is required
30-
* @return SchemaProperty
25+
* @param string $name Property name
26+
* @param array<string, mixed> $objectProperties Properties of objects in the array
27+
* @param array<string> $requiredProperties Required properties in each object
28+
* @param string $description Property description
29+
* @param bool $required Whether the array property itself is required
3130
*/
3231
public static function arrayOfObjects(
3332
string $name,
@@ -41,7 +40,7 @@ public static function arrayOfObjects(
4140
'properties' => $objectProperties,
4241
];
4342

44-
if (!empty($requiredProperties)) {
43+
if (! empty($requiredProperties)) {
4544
$items['required'] = $requiredProperties;
4645
}
4746

@@ -57,11 +56,10 @@ public static function arrayOfObjects(
5756
/**
5857
* Creates an array property that contains primitive values.
5958
*
60-
* @param string $name Property name
61-
* @param string $itemType Type of items in the array ('string', 'integer', 'number', 'boolean')
62-
* @param string $description Property description
63-
* @param bool $required Whether the array property is required
64-
* @return SchemaProperty
59+
* @param string $name Property name
60+
* @param string $itemType Type of items in the array ('string', 'integer', 'number', 'boolean')
61+
* @param string $description Property description
62+
* @param bool $required Whether the array property is required
6563
*/
6664
public static function arrayOfPrimitives(
6765
string $name,
@@ -81,12 +79,11 @@ public static function arrayOfPrimitives(
8179
/**
8280
* Creates an object property with nested properties.
8381
*
84-
* @param string $name Property name
85-
* @param array<string, mixed> $properties Nested object properties
86-
* @param array<string> $requiredProperties Required nested properties
87-
* @param string $description Property description
88-
* @param bool $required Whether the object property is required
89-
* @return SchemaProperty
82+
* @param string $name Property name
83+
* @param array<string, mixed> $properties Nested object properties
84+
* @param array<string> $requiredProperties Required nested properties
85+
* @param string $description Property description
86+
* @param bool $required Whether the object property is required
9087
*/
9188
public static function nestedObject(
9289
string $name,
@@ -97,7 +94,7 @@ public static function nestedObject(
9794
): SchemaProperty {
9895
$objectSchema = ['properties' => $properties];
9996

100-
if (!empty($requiredProperties)) {
97+
if (! empty($requiredProperties)) {
10198
$objectSchema['required'] = $requiredProperties;
10299
}
103100

src/Services/ToolService/Schema/SchemaProperty.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function __construct(
3030
private array $enum = [],
3131
private string $default = '',
3232
private bool $required = false,
33-
private array|null $items = null,
34-
private array|null $properties = null,
33+
private ?array $items = null,
34+
private ?array $properties = null,
3535
private array $additionalProperties = []
3636
) {}
3737

@@ -90,7 +90,7 @@ public function getDefault(): string
9090
*
9191
* @return array|null The items schema definition, or null if not applicable
9292
*/
93-
public function getItems(): array|null
93+
public function getItems(): ?array
9494
{
9595
return $this->items;
9696
}
@@ -100,7 +100,7 @@ public function getItems(): array|null
100100
*
101101
* @return array|null The nested properties definition, or null if not applicable
102102
*/
103-
public function getProperties(): array|null
103+
public function getProperties(): ?array
104104
{
105105
return $this->properties;
106106
}

src/Services/ToolService/Schema/StructuredSchema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public function asArray(): array
7171
}
7272

7373
// Add enum if specified
74-
if (!empty($property->getEnum())) {
74+
if (! empty($property->getEnum())) {
7575
$propertySchema['enum'] = $property->getEnum();
7676
}
7777

7878
// Add default if specified
79-
if (!empty($property->getDefault())) {
79+
if (! empty($property->getDefault())) {
8080
$propertySchema['default'] = $property->getDefault();
8181
}
8282

tests/Services/ToolService/Schema/SchemaBuilderTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function test_array_of_objects_creates_correct_schema(): void
1616
[
1717
'id' => ['type' => 'string'],
1818
'title' => ['type' => 'string'],
19-
'url' => ['type' => 'string']
19+
'url' => ['type' => 'string'],
2020
],
2121
['id', 'title'],
2222
'Array of search results',
@@ -35,7 +35,7 @@ public function test_array_of_objects_creates_correct_schema(): void
3535
$this->assertEquals([
3636
'id' => ['type' => 'string'],
3737
'title' => ['type' => 'string'],
38-
'url' => ['type' => 'string']
38+
'url' => ['type' => 'string'],
3939
], $items['properties']);
4040
}
4141

@@ -47,7 +47,7 @@ public function test_complete_schema_generates_correct_json_schema(): void
4747
[
4848
'id' => ['type' => 'string'],
4949
'title' => ['type' => 'string'],
50-
'url' => ['type' => 'string']
50+
'url' => ['type' => 'string'],
5151
],
5252
['id', 'title']
5353
)
@@ -64,13 +64,13 @@ public function test_complete_schema_generates_correct_json_schema(): void
6464
'properties' => [
6565
'id' => ['type' => 'string'],
6666
'title' => ['type' => 'string'],
67-
'url' => ['type' => 'string']
67+
'url' => ['type' => 'string'],
6868
],
69-
'required' => ['id', 'title']
70-
]
71-
]
69+
'required' => ['id', 'title'],
70+
],
71+
],
7272
],
73-
'required' => []
73+
'required' => [],
7474
];
7575

7676
$this->assertEquals($expected, $schema->asArray());
@@ -96,7 +96,7 @@ public function test_nested_object_creates_correct_schema(): void
9696
'metadata',
9797
[
9898
'author' => ['type' => 'string'],
99-
'timestamp' => ['type' => 'integer']
99+
'timestamp' => ['type' => 'integer'],
100100
],
101101
['author'],
102102
'Metadata object'
@@ -110,7 +110,7 @@ public function test_nested_object_creates_correct_schema(): void
110110
$this->assertNotNull($properties);
111111
$this->assertEquals([
112112
'author' => ['type' => 'string'],
113-
'timestamp' => ['type' => 'integer']
113+
'timestamp' => ['type' => 'integer'],
114114
], $properties['properties']);
115115
$this->assertEquals(['author'], $properties['required']);
116116
}

0 commit comments

Comments
 (0)