File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 12
12
namespace Serafim \Contracts \Compiler \Visitor ;
13
13
14
14
use PhpParser \Node ;
15
+ use PhpParser \Node \Stmt \Class_ ;
15
16
use PhpParser \NodeTraverser ;
16
17
use PhpParser \NodeVisitorAbstract ;
17
18
use Serafim \Contracts \Attribute \Invariant ;
@@ -54,7 +55,7 @@ public function __construct(
54
55
*/
55
56
public function enterNode (Node $ node ): ?int
56
57
{
57
- if ($ node instanceof Node \ Stmt \ Class_) {
58
+ if ($ node instanceof Class_) {
58
59
$ this ->class = $ node ->name ->toString ();
59
60
}
60
61
@@ -71,12 +72,16 @@ public function enterNode(Node $node): ?int
71
72
public function leaveNode (Node $ node ): void
72
73
{
73
74
// Clear all invariants
74
- if ($ node instanceof Node \ Stmt \ Class_) {
75
+ if ($ node instanceof Class_) {
75
76
$ this ->invariants = [];
76
77
$ this ->class = null ;
77
78
}
78
79
79
80
if ($ node instanceof Node \Stmt \ClassMethod) {
81
+ if (($ node ->flags & Class_::MODIFIER_ABSTRACT ) === Class_::MODIFIER_ABSTRACT ) {
82
+ return ;
83
+ }
84
+
80
85
$ this ->injector ->inject ($ this ->file , $ node , $ this ->invariants );
81
86
}
82
87
}
You can’t perform that action at this time.
0 commit comments