Skip to content

Commit a6bba3f

Browse files
authored
Optimized code for ProxyCallVisitor.php
1 parent eeabec4 commit a6bba3f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/Aop/ProxyCallVisitor.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ class ProxyCallVisitor extends NodeVisitorAbstract
3737
/**
3838
* Define the proxy handler trait here.
3939
*/
40-
private array $proxyTraits
41-
= [
42-
ProxyTrait::class,
43-
];
40+
private array $proxyTraits = [
41+
ProxyTrait::class,
42+
];
4443

4544
private bool $shouldRewrite = false;
4645

@@ -73,11 +72,7 @@ public function enterNode(Node $node)
7372
{
7473
switch ($node) {
7574
case $node instanceof ClassMethod:
76-
if ($this->shouldRewrite($node)) {
77-
$this->shouldRewrite = true;
78-
} else {
79-
$this->shouldRewrite = false;
80-
}
75+
$this->shouldRewrite = $this->shouldRewrite($node);
8176
break;
8277
}
8378

@@ -213,9 +208,9 @@ private function getMagicConst(): Node\Scalar\MagicConst
213208
};
214209
}
215210

216-
private function shouldRewrite(ClassMethod $node)
211+
private function shouldRewrite(ClassMethod $node): bool
217212
{
218-
if (in_array($this->visitorMetadata->classLike, [Node\Stmt\Interface_::class])) {
213+
if ($this->visitorMetadata->classLike == Node\Stmt\Interface_::class) {
219214
return false;
220215
}
221216

0 commit comments

Comments
 (0)