Skip to content

Commit f7c1ea8

Browse files
committed
style: new pint and new lines
1 parent ace8bb2 commit f7c1ea8

25 files changed

+64
-283
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
},
7474
"minimum-stability": "dev",
7575
"prefer-stable": true
76-
}
76+
}

pint.json

Lines changed: 13 additions & 207 deletions
Original file line numberDiff line numberDiff line change
@@ -1,211 +1,17 @@
11
{
2-
"preset": "empty",
2+
"preset": "laravel",
33
"rules": {
4-
"align_multiline_comment": true,
5-
"array_indentation": true,
6-
"array_syntax": {
7-
"syntax": "short"
8-
},
9-
"binary_operator_spaces": {
10-
"default": "single_space"
11-
},
12-
"blank_line_after_namespace": true,
13-
"blank_line_after_opening_tag": true,
14-
"blank_line_before_statement": {
15-
"statements": [
16-
"return"
17-
]
18-
},
19-
"blank_line_between_import_groups": true,
20-
"blank_lines_before_namespace": true,
21-
"braces_position": {
22-
"control_structures_opening_brace": "same_line",
23-
"functions_opening_brace": "next_line_unless_newline_at_signature_end",
24-
"anonymous_functions_opening_brace": "same_line",
25-
"classes_opening_brace": "next_line_unless_newline_at_signature_end",
26-
"anonymous_classes_opening_brace": "next_line_unless_newline_at_signature_end",
27-
"allow_single_line_empty_anonymous_classes": false,
28-
"allow_single_line_anonymous_functions": false
29-
},
30-
"cast_spaces": true,
31-
"class_definition": true,
32-
"class_reference_name_casing": true,
33-
"clean_namespace": true,
34-
"compact_nullable_type_declaration": true,
35-
"concat_space": true,
36-
"constant_case": {
37-
"case": "lower"
38-
},
39-
"control_structure_braces": true,
40-
"declare_equal_normalize": true,
41-
"elseif": true,
42-
"encoding": true,
43-
"full_opening_tag": true,
44-
"function_declaration": true,
45-
"heredoc_to_nowdoc": true,
46-
"include": true,
47-
"increment_style": {
48-
"style": "post"
49-
},
50-
"indentation_type": true,
51-
"integer_literal_case": true,
52-
"lambda_not_used_import": true,
53-
"line_ending": true,
54-
"list_syntax": {
55-
"syntax": "short"
56-
},
57-
"lowercase_cast": true,
58-
"lowercase_keywords": true,
59-
"lowercase_static_reference": true,
60-
"magic_constant_casing": true,
61-
"magic_method_casing": true,
62-
"method_argument_space": {
63-
"on_multiline": "ignore"
4+
"global_namespace_import": {
5+
"import_classes": true,
6+
"import_constants": true
647
},
8+
"combine_consecutive_issets": true,
9+
"combine_consecutive_unsets": true,
10+
"explicit_string_variable": true,
6511
"method_chaining_indentation": true,
66-
"multiline_whitespace_before_semicolons": {
67-
"strategy": "no_multi_line"
68-
},
69-
"native_function_casing": true,
70-
"native_type_declaration_casing": true,
71-
"no_alternative_syntax": true,
72-
"no_binary_string": true,
73-
"no_blank_lines_after_class_opening": true,
74-
"no_blank_lines_after_phpdoc": true,
75-
"no_closing_tag": true,
76-
"no_empty_phpdoc": true,
77-
"no_empty_statement": true,
78-
"no_extra_blank_lines": {
79-
"tokens": [
80-
"extra",
81-
"throw",
82-
"use"
83-
]
84-
},
85-
"no_leading_import_slash": true,
86-
"no_leading_namespace_whitespace": true,
87-
"no_mixed_echo_print": {
88-
"use": "echo"
89-
},
90-
"no_multiline_whitespace_around_double_arrow": true,
91-
"no_short_bool_cast": true,
92-
"no_singleline_whitespace_before_semicolons": true,
93-
"no_space_around_double_colon": true,
94-
"no_spaces_around_offset": {
95-
"positions": [
96-
"inside",
97-
"outside"
98-
]
99-
},
100-
"no_spaces_after_function_name": true,
101-
"no_trailing_comma_in_singleline": true,
102-
"no_trailing_whitespace": true,
103-
"no_trailing_whitespace_in_comment": true,
104-
"no_unneeded_braces": true,
105-
"no_unneeded_control_parentheses": true,
106-
"no_unneeded_import_alias": true,
107-
"no_unset_cast": true,
108-
"no_unused_imports": true,
109-
"no_useless_return": true,
110-
"no_whitespace_before_comma_in_array": true,
111-
"no_whitespace_in_blank_line": true,
112-
"normalize_index_brace": true,
113-
"not_operator_with_successor_space": true,
114-
"nullable_type_declaration_for_default_null_value": true,
115-
"object_operator_without_whitespace": true,
116-
"ordered_imports": {
117-
"sort_algorithm": "alpha",
118-
"imports_order": [
119-
"const",
120-
"class",
121-
"function"
122-
]
123-
},
124-
"phpdoc_align": {
125-
"align": "left",
126-
"spacing": {
127-
"param": 2
128-
}
129-
},
130-
"phpdoc_indent": true,
131-
"phpdoc_inline_tag_normalizer": true,
132-
"phpdoc_no_access": true,
133-
"phpdoc_no_package": true,
134-
"phpdoc_no_useless_inheritdoc": true,
135-
"phpdoc_order": {
136-
"order": [
137-
"param",
138-
"return",
139-
"throws"
140-
]
141-
},
142-
"phpdoc_return_self_reference": true,
143-
"phpdoc_scalar": true,
144-
"phpdoc_separation": {
145-
"groups": [
146-
[
147-
"deprecated",
148-
"link",
149-
"see",
150-
"since"
151-
],
152-
[
153-
"author",
154-
"copyright",
155-
"license"
156-
],
157-
[
158-
"category",
159-
"package",
160-
"subpackage"
161-
],
162-
[
163-
"property",
164-
"property-read",
165-
"property-write"
166-
],
167-
[
168-
"param",
169-
"return"
170-
]
171-
]
172-
},
173-
"phpdoc_single_line_var_spacing": true,
174-
"phpdoc_summary": true,
175-
"phpdoc_trim": true,
176-
"phpdoc_types": true,
177-
"phpdoc_var_without_name": true,
178-
"return_type_declaration": {
179-
"space_before": "none"
180-
},
181-
"short_scalar_cast": true,
182-
"single_blank_line_at_eof": true,
183-
"single_class_element_per_statement": true,
184-
"single_import_per_statement": true,
185-
"single_line_after_imports": true,
186-
"single_line_comment_style": true,
187-
"single_quote": true,
188-
"space_after_semicolon": true,
189-
"spaces_inside_parentheses": true,
190-
"standardize_not_equals": true,
191-
"switch_case_semicolon_to_colon": true,
192-
"switch_case_space": true,
193-
"switch_continue_to_break": true,
194-
"ternary_operator_spaces": true,
195-
"trailing_comma_in_multiline": true,
196-
"trim_array_spaces": true,
197-
"type_declaration_spaces": true,
198-
"types_spaces": true,
199-
"unary_operator_spaces": true,
200-
"visibility_required": {
201-
"elements": [
202-
"method",
203-
"property"
204-
]
205-
},
206-
"whitespace_after_comma_in_array": true
207-
},
208-
"notPath": [
209-
"tests/Foundation/fixtures/bad-syntax-strategy.php"
210-
]
211-
}
12+
"no_binary_string": false,
13+
"strict_comparison": true,
14+
"strict_param": true,
15+
"ternary_to_null_coalescing": true
16+
}
17+
}

src/Console/Commands/McpInspectorCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Laravel\Mcp\Console\Commands;
44

5+
use Exception;
56
use Illuminate\Console\Command;
67
use Symfony\Component\Console\Attribute\AsCommand;
78
use Symfony\Component\Console\Input\InputArgument;
@@ -40,7 +41,7 @@ public function handle()
4041
$process->mustRun(function ($type, $buffer) {
4142
echo $buffer;
4243
});
43-
} catch (\Exception $e) {
44+
} catch (Exception $e) {
4445
$this->error('Failed to start MCP Inspector: '.$e->getMessage());
4546

4647
return Command::FAILURE;

src/Methods/Initialize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function handle(JsonRpcRequest $request, ServerContext $context): JsonRpc
1717
{
1818
$requestedVersion = $request->params['protocolVersion'] ?? null;
1919

20-
if (! is_null($requestedVersion) && ! in_array($requestedVersion, $context->supportedProtocolVersions)) {
20+
if (! is_null($requestedVersion) && ! in_array($requestedVersion, $context->supportedProtocolVersions, true)) {
2121
throw new JsonRpcException(
2222
message: 'Unsupported protocol version',
2323
code: -32602,

src/Resources/ResourceResult.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
class ResourceResult implements Arrayable
1010
{
11-
public function __construct(public readonly Resource $resource)
12-
{
13-
}
11+
public function __construct(public readonly Resource $resource) {}
1412

1513
public function toArray(): array
1614
{

src/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ public function boot()
165165
*/
166166
public function addTool($tool)
167167
{
168-
if (! in_array($tool, $this->registeredTools)) {
168+
if (! in_array($tool, $this->registeredTools, true)) {
169169
$this->registeredTools[] = $tool;
170170
}
171171
}
172172

173173
public function addResource($resource)
174174
{
175-
if (! in_array($resource, $this->registeredResources)) {
175+
if (! in_array($resource, $this->registeredResources, true)) {
176176
$this->registeredResources[] = $resource;
177177
}
178178
}

src/ServerContext.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ public function __construct(
1717
public array $resources,
1818
public int $maxPaginationLength,
1919
public int $defaultPaginationLength,
20-
) {
21-
}
20+
) {}
2221
}

src/Tools/Annotations/IsDestructive.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#[Attribute(Attribute::TARGET_CLASS)]
88
class IsDestructive implements Annotation
99
{
10-
public function __construct(public bool $value = true)
11-
{
12-
}
10+
public function __construct(public bool $value = true) {}
1311

1412
public function key(): string
1513
{

src/Tools/Annotations/IsIdempotent.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#[Attribute(Attribute::TARGET_CLASS)]
88
class IsIdempotent implements Annotation
99
{
10-
public function __construct(public bool $value = true)
11-
{
12-
}
10+
public function __construct(public bool $value = true) {}
1311

1412
public function key(): string
1513
{

0 commit comments

Comments
 (0)