Skip to content

Commit bac286d

Browse files
committed
specify Stmt ClassName.
1 parent aa1a8da commit bac286d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Php/PhpAccessModifier.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
use PhpParser\Node\Stmt;
55
use PhpParser\Node\Stmt\ {
6+
ClassConst,
67
ClassMethod,
8+
Property,
79
};
810

911
class PhpAccessModifier {
@@ -14,7 +16,7 @@ class PhpAccessModifier {
1416
protected bool $final = false;
1517
protected bool $static = false;
1618

17-
public function __construct(Stmt $stmt) {
19+
public function __construct(ClassConst|Property|ClassMethod $stmt) {
1820
$this->public = $stmt->isPublic();
1921
$this->protected = $stmt->isProtected();
2022
$this->private = $stmt->isPrivate();

src/Php/PhpClass.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php declare(strict_types=1);
22
namespace Smeghead\PhpClassDiagram\Php;
33

4-
use PhpParser\NodeAbstract;
54
use PhpParser\Node\ {
65
NullableType,
76
Identifier,
@@ -11,18 +10,20 @@
1110
use PhpParser\Node\Name\FullyQualified;
1211
use PhpParser\Node\Stmt;
1312
use PhpParser\Node\Stmt\ {
13+
Class_,
1414
Namespace_,
1515
ClassLike,
1616
ClassMethod,
1717
Property,
1818
GroupUse,
19+
Interface_,
1920
Use_,
2021
};
2122

2223
class PhpClass {
2324
/** @var string[] directory parts */
2425
protected array $dirs;
25-
protected Stmt $syntax;
26+
protected Class_|Interface_ $syntax;
2627
protected array $full;
2728

2829
public function __construct(string $filename, Stmt $syntax, array $full) {

src/Php/PhpMethod.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use PhpParser\Node\ {
55
NullableType,
66
Name,
7+
Param,
78
};
89
use PhpParser\Node\Stmt\ {
910
ClassMethod,
@@ -22,7 +23,7 @@ public function __construct(ClassMethod $method, PhpClass $class) {
2223
if ( ! empty($doc)) {
2324
$docString = $doc->getText();
2425
}
25-
$params = array_map(function($x) use ($class, $docString){
26+
$params = array_map(function(Param $x) use ($class, $docString){
2627
$type = PhpTypeExpression::buildByMethodParam($x, $class->getNamespace(), $docString, $x->var->name, $class->getUses());
2728
return new PhpMethodParameter($x->var->name, $type);
2829
}, $method->getParams());

0 commit comments

Comments
 (0)