Skip to content

Commit be4669b

Browse files
committed
Remove getSummary method and update tests and usages to use getDescription instead
1 parent 57ac857 commit be4669b

File tree

3 files changed

+4
-31
lines changed

3 files changed

+4
-31
lines changed

src/Capability/Discovery/DocBlockParser.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,6 @@ public function parseDocBlock(string|false|null $docComment): ?DocBlock
5555
}
5656
}
5757

58-
/**
59-
* Gets the summary line from a DocBlock.
60-
*/
61-
public function getSummary(?DocBlock $docBlock): ?string
62-
{
63-
if (!$docBlock) {
64-
return null;
65-
}
66-
$summary = trim($docBlock->getSummary());
67-
68-
return $summary ?: null; // Return null if empty after trimming
69-
}
70-
7158
/**
7259
* Gets the description from a DocBlock (summary + description body).
7360
*/

src/Capability/Registry/Loader/ArrayLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function load(RegistryInterface $registry): void
105105
$docBlock = $docBlockParser->parseDocBlock($reflection->getDocComment() ?? null);
106106

107107
$name = $data['name'] ?? ('__invoke' === $methodName ? $classShortName : $methodName);
108-
$description = $data['description'] ?? $docBlockParser->getSummary($docBlock) ?? null;
108+
$description = $data['description'] ?? $docBlockParser->getDescription($docBlock) ?? null;
109109
}
110110

111111
$inputSchema = $data['inputSchema'] ?? $schemaGenerator->generate($reflection);
@@ -145,7 +145,7 @@ public function load(RegistryInterface $registry): void
145145
$docBlock = $docBlockParser->parseDocBlock($reflection->getDocComment() ?? null);
146146

147147
$name = $data['name'] ?? ('__invoke' === $methodName ? $classShortName : $methodName);
148-
$description = $data['description'] ?? $docBlockParser->getSummary($docBlock) ?? null;
148+
$description = $data['description'] ?? $docBlockParser->getDescription($docBlock) ?? null;
149149
}
150150

151151
$resource = new Resource(
@@ -185,7 +185,7 @@ public function load(RegistryInterface $registry): void
185185
$docBlock = $docBlockParser->parseDocBlock($reflection->getDocComment() ?? null);
186186

187187
$name = $data['name'] ?? ('__invoke' === $methodName ? $classShortName : $methodName);
188-
$description = $data['description'] ?? $docBlockParser->getSummary($docBlock) ?? null;
188+
$description = $data['description'] ?? $docBlockParser->getDescription($docBlock) ?? null;
189189
}
190190

191191
$template = new ResourceTemplate(
@@ -224,7 +224,7 @@ public function load(RegistryInterface $registry): void
224224
$docBlock = $docBlockParser->parseDocBlock($reflection->getDocComment() ?? null);
225225

226226
$name = $data['name'] ?? ('__invoke' === $methodName ? $classShortName : $methodName);
227-
$description = $data['description'] ?? $docBlockParser->getSummary($docBlock) ?? null;
227+
$description = $data['description'] ?? $docBlockParser->getDescription($docBlock) ?? null;
228228
}
229229

230230
$arguments = [];

tests/Unit/Capability/Discovery/DocBlockParserTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ protected function setUp(): void
2828
$this->parser = new DocBlockParser();
2929
}
3030

31-
public function testGetSummaryReturnsCorrectSummary()
32-
{
33-
$method = new \ReflectionMethod(DocBlockTestFixture::class, 'methodWithSummaryOnly');
34-
$docComment = $method->getDocComment() ?: null;
35-
$docBlock = $this->parser->parseDocBlock($docComment);
36-
$this->assertEquals('Simple summary line.', $this->parser->getSummary($docBlock));
37-
38-
$method2 = new \ReflectionMethod(DocBlockTestFixture::class, 'methodWithSummaryAndDescription');
39-
$docComment2 = $method2->getDocComment() ?: null;
40-
$docBlock2 = $this->parser->parseDocBlock($docComment2);
41-
$this->assertEquals('Summary line here.', $this->parser->getSummary($docBlock2));
42-
}
43-
4431
public function testGetDescriptionReturnsCorrectDescription()
4532
{
4633
$method = new \ReflectionMethod(DocBlockTestFixture::class, 'methodWithSummaryAndDescription');
@@ -136,7 +123,6 @@ public function testHandlesMethodWithNoDocblockGracefully()
136123
$docBlock = $this->parser->parseDocBlock($docComment);
137124

138125
$this->assertNull($docBlock);
139-
$this->assertNull($this->parser->getSummary($docBlock));
140126
$this->assertNull($this->parser->getDescription($docBlock));
141127
$this->assertEmpty($this->parser->getParamTags($docBlock));
142128
}

0 commit comments

Comments
 (0)