Skip to content

Commit 02e6fdc

Browse files
committed
Allow sort of constants, methods and namespace imports in InterfaceBuilder - Close #52
1 parent ef5a0f2 commit 02e6fdc

File tree

3 files changed

+387
-29
lines changed

3 files changed

+387
-29
lines changed

src/Builder/ClassMethodBuilder.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OpenCodeModeling\CodeAst\Code\DocBlock\DocBlock;
1616
use OpenCodeModeling\CodeAst\Code\MethodGenerator;
1717
use OpenCodeModeling\CodeAst\NodeVisitor\ClassMethod;
18+
use OpenCodeModeling\CodeAst\NodeVisitor\InterfaceMethod;
1819
use PhpParser\Comment\Doc;
1920
use PhpParser\Node;
2021
use PhpParser\NodeTraverser;
@@ -304,8 +305,12 @@ public function isStatic(): bool
304305
return $this->isStatic;
305306
}
306307

307-
public function generate(Parser $parser): NodeVisitor
308+
public function generate(Parser $parser, bool $isInterfaceMethod = false): NodeVisitor
308309
{
310+
if ($isInterfaceMethod === true) {
311+
return new InterfaceMethod($this->methodGenerator($parser));
312+
}
313+
309314
return new ClassMethod($this->methodGenerator($parser));
310315
}
311316

0 commit comments

Comments
 (0)