Skip to content

Commit 3c99df5

Browse files
authored
Merge pull request #38 from php-api-clients/WebHooks-resolve-return-webhookinterace
WebHook::resolve return WebHookInterface
2 parents 1c5cdee + 61c497c commit 3c99df5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Generator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ private function all(string $namespace): iterable
140140
);
141141
yield from WebHooks::generate(
142142
$this->dirname($namespace . 'WebHooks'),
143+
$namespace,
143144
$pathClassNameMapping,
144145
);
145146
}

src/Generator/WebHooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class WebHooks
2626
* @return iterable<Node>
2727
* @throws \Jawira\CaseConverter\CaseConverterException
2828
*/
29-
public static function generate(string $namespace, array $eventClassNameMapping): iterable
29+
public static function generate(string $namespace, string $baseNamespace, array $eventClassNameMapping): iterable
3030
{
3131
$factory = new BuilderFactory();
3232
$stmt = $factory->namespace($namespace);
@@ -50,7 +50,7 @@ public static function generate(string $namespace, array $eventClassNameMapping)
5050
Class_::MODIFIER_PUBLIC
5151
)
5252
)->addStmt(
53-
$factory->method('resolve')->makePublic()->makeStatic()->setReturnType('object')->addParam(
53+
$factory->method('resolve')->makePublic()->makeStatic()->setReturnType('\\' . $baseNamespace . 'WebHookInterface')->addParam(
5454
(new Param('event'))->setType('string')
5555
)->addStmt(
5656
new Node\Stmt\If_(

0 commit comments

Comments
 (0)