Skip to content

Commit 8b7e410

Browse files
authored
Merge pull request #84 from php-api-clients/correct-hydration-templates
Correct hydration templates
2 parents 854bab9 + ff6b416 commit 8b7e410

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/Generator/Client.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
3434
$factory = new BuilderFactory();
3535
$stmt = $factory->namespace(rtrim($namespace, '\\'));
3636

37-
$class = $factory->class('Client')->implement(new Node\Name('ClientInterface'))->makeFinal()->setDocComment(
38-
new Doc(implode(PHP_EOL, [
39-
'/**',
40-
' * @template H',
41-
' */',
42-
]))
43-
)->addStmt(
37+
$class = $factory->class('Client')->implement(new Node\Name('ClientInterface'))->makeFinal()->addStmt(
4438
$factory->property('authentication')->setType('\\' . AuthenticationInterface::class)->makeReadonly()->makePrivate()
4539
)->addStmt(
4640
$factory->property('browser')->setType('\\' . Browser::class)->makeReadonly()->makePrivate()
@@ -383,6 +377,7 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
383377
$factory->method('hydrateObject')->makePublic()->setDocComment(
384378
new Doc(implode(PHP_EOL, [
385379
'/**',
380+
' * @template H',
386381
' * @param class-string<H> $className',
387382
' * @return H',
388383
' */',

src/Generator/ClientInterface.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
3434
$factory = new BuilderFactory();
3535
$stmt = $factory->namespace(rtrim($namespace, '\\'));
3636

37-
$class = $factory->interface('ClientInterface')->setDocComment(
38-
new Doc(implode(PHP_EOL, [
39-
'/**',
40-
' * @template H',
41-
' */',
42-
]))
43-
);
37+
$class = $factory->interface('ClientInterface');
4438
$rawCallReturnTypes = [];
4539
$operationCalls = [];
4640
$callReturnTypes = [];
@@ -131,6 +125,7 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
131125
$factory->method('hydrateObject')->makePublic()->setDocComment(
132126
new Doc(implode(PHP_EOL, [
133127
'/**',
128+
' * @template H',
134129
' * @param class-string<H> $className',
135130
' * @return H',
136131
' */',

0 commit comments

Comments
 (0)