Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit a0def04

Browse files
Merge pull request #11 from EdouardCourty/feat/add-symfony-rule-in-php-cs-fixer
chore(style): add @symfony php-cs-fixer rule
2 parents 46059bb + a68ab92 commit a0def04

12 files changed

Lines changed: 24 additions & 27 deletions

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
->setRiskyAllowed(true)
1212
->setRules([
1313
'@PSR12' => true,
14+
'@Symfony' => true,
1415
'simplified_null_return' => false,
1516
'concat_space' => ['spacing' => 'one'],
1617
'phpdoc_summary' => false,

src/Attribute/AsMethodHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class AsMethodHandler
1212
{
1313
/**
14-
* @param string $methodName The JSON-RPC method name that the handler will respond to.
14+
* @param string $methodName the JSON-RPC method name that the handler will respond to
1515
*/
1616
public function __construct(
1717
public string $methodName,

src/Attribute/AsPrompt.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class AsPrompt
1515
private readonly array $arguments;
1616

1717
/**
18-
* @param string $name The name of the prompt.
19-
* @param string|null $description A description of the prompt.
20-
* @param array<Argument|mixed> $arguments An array of argument definitions for the prompt.
18+
* @param string $name the name of the prompt
19+
* @param string|null $description a description of the prompt
20+
* @param array<Argument|mixed> $arguments an array of argument definitions for the prompt
2121
*/
2222
public function __construct(
2323
public readonly string $name,

src/Attribute/AsTool.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class AsTool
1616
private readonly ToolAnnotations $toolAnnotations;
1717

1818
/**
19-
* @param string $name The name of the tool, which can be called by clients.
20-
* @param string $description A human-readable description of the tool, useful for LLMs to understand its purpose.
21-
* @param ToolAnnotations|null $annotations Optional annotations for the tool, providing additional metadata such as title, read-only status, and hints about the tool's behavior.
19+
* @param string $name the name of the tool, which can be called by clients
20+
* @param string $description a human-readable description of the tool, useful for LLMs to understand its purpose
21+
* @param ToolAnnotations|null $annotations optional annotations for the tool, providing additional metadata such as title, read-only status, and hints about the tool's behavior
2222
*/
2323
public function __construct(
2424
public string $name,

src/Attribute/ToolAnnotations.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
class ToolAnnotations
1414
{
1515
/**
16-
* @param string $title A human-readable title for the tool, useful for UI display
17-
* @param bool $readOnlyHint If true, indicates the tool does not modify its environment
18-
* @param bool $destructiveHint If true, the tool may perform destructive updates (only meaningful when readOnlyHint is false)
19-
* @param bool $idempotentHint If true, calling the tool repeatedly with the same arguments has no additional effect (only meaningful when readOnlyHint is false)
20-
* @param bool $openWorldHint If true, the tool may interact with an “open world” of external entities
16+
* @param string $title A human-readable title for the tool, useful for UI display
17+
* @param bool $readOnlyHint If true, indicates the tool does not modify its environment
18+
* @param bool $destructiveHint If true, the tool may perform destructive updates (only meaningful when readOnlyHint is false)
19+
* @param bool $idempotentHint If true, calling the tool repeatedly with the same arguments has no additional effect (only meaningful when readOnlyHint is false)
20+
* @param bool $openWorldHint If true, the tool may interact with an “open world” of external entities
2121
*/
2222
public function __construct(
2323
public readonly string $title = '',

src/Exception/RequestHandlingException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
namespace Ecourty\McpServerBundle\Exception;
66

7-
use Throwable;
8-
97
/**
108
* Exception thrown when there is an error handling a JSON-RPC request.
119
*/
1210
class RequestHandlingException extends \Exception
1311
{
14-
public function __construct(Throwable $previous)
12+
public function __construct(\Throwable $previous)
1513
{
1614
parent::__construct($previous->getMessage(), $previous->getCode(), $previous);
1715
}

src/IO/ToolResult.php

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

99
class ToolResult
1010
{
11-
/** @var ToolResultInterface[] $elements */
11+
/** @var ToolResultInterface[] */
1212
private array $elements = [];
1313
private bool $isError = false;
1414

src/Prompt/Argument.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
class Argument
1111
{
1212
/**
13-
* @param bool $required Indicates if the argument is required (will throw an error if true and not provided).
14-
* @param bool $allowUnsafe Indicates if the argument allows unsafe content (will not be sanitized if true).
13+
* @param bool $required indicates if the argument is required (will throw an error if true and not provided)
14+
* @param bool $allowUnsafe indicates if the argument allows unsafe content (will not be sanitized if true)
1515
*/
1616
public function __construct(
1717
public readonly string $name,

src/Service/SchemaExtractor.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
use OpenApi\Attributes\Property;
99
use OpenApi\Attributes\Schema;
1010
use OpenApi\Generator;
11-
use ReflectionClass;
12-
use ReflectionProperty;
1311

1412
/**
1513
* Extracts schema information from a class using OpenAPI attributes.
@@ -24,10 +22,10 @@ class SchemaExtractor
2422
*/
2523
public function extract(string $class): array
2624
{
27-
$reflection = new ReflectionClass($class);
25+
$reflection = new \ReflectionClass($class);
2826
$properties = [];
2927

30-
foreach ($reflection->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
28+
foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
3129
$attribute = $this->getPropertyAttribute($property);
3230

3331
if ($attribute === null) {
@@ -94,7 +92,7 @@ private function resolve(mixed $value, mixed $default = null): mixed
9492
return $value === Generator::UNDEFINED ? $default : $value;
9593
}
9694

97-
private function getPropertyAttribute(ReflectionProperty $property): ?Property
95+
private function getPropertyAttribute(\ReflectionProperty $property): ?Property
9896
{
9997
$propertyAttributes = $property->getAttributes(Property::class);
10098

@@ -105,7 +103,7 @@ private function getPropertyAttribute(ReflectionProperty $property): ?Property
105103
return $propertyAttributes[0]->newInstance();
106104
}
107105

108-
private function getSchemaAttribute(ReflectionClass $class): ?Schema // @phpstan-ignore missingType.generics
106+
private function getSchemaAttribute(\ReflectionClass $class): ?Schema // @phpstan-ignore missingType.generics
109107
{
110108
$schemaAttributes = $class->getAttributes(Schema::class);
111109

tests/TestApp/src/Prompt/GenerateGitCommitMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Ecourty\McpServerBundle\IO\Prompt\Content\TextContent;
1010
use Ecourty\McpServerBundle\IO\Prompt\PromptMessage;
1111
use Ecourty\McpServerBundle\IO\Prompt\PromptResult;
12-
use Ecourty\McpServerBundle\Prompt\ArgumentCollection;
1312
use Ecourty\McpServerBundle\Prompt\Argument;
13+
use Ecourty\McpServerBundle\Prompt\ArgumentCollection;
1414

1515
#[AsPrompt(
1616
name: 'generate-git-commit-message',

0 commit comments

Comments
 (0)