@@ -11,7 +11,6 @@ |
||
11 | 11 | namespace Kenjis\MonkeyPatch; |
12 | 12 | |
13 | 13 | use LogicException; |
14 | -use RuntimeException; |
|
15 | 14 | use PhpParser\ParserFactory; |
16 | 15 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
17 | 16 |
@@ -70,8 +70,7 @@ |
||
70 | 70 | if (isset($config['root_dir'])) |
71 | 71 | { |
72 | 72 | Cache::setProjectRootDir($config['root_dir']); |
73 | - } |
|
74 | - else |
|
73 | + } else |
|
75 | 74 | { |
76 | 75 | // APPPATH is constant in CodeIgniter |
77 | 76 | Cache::setProjectRootDir(APPPATH . '../'); |
@@ -14,7 +14,6 @@ |
||
14 | 14 | require __DIR__ . '/ConstantPatcher/Proxy.php'; |
15 | 15 | |
16 | 16 | use LogicException; |
17 | - |
|
18 | 17 | use Kenjis\MonkeyPatch\Patcher\ConstantPatcher\NodeVisitor; |
19 | 18 | |
20 | 19 | class ConstantPatcher extends AbstractPatcher |
@@ -181,8 +181,7 @@ discard block |
||
181 | 181 | if (is_string($token)) |
182 | 182 | { |
183 | 183 | $new_source .= $token; |
184 | - } |
|
185 | - elseif ($i == $replacement['key']) |
|
184 | + } elseif ($i == $replacement['key']) |
|
186 | 185 | { |
187 | 186 | $new_source .= $replacement['value']; |
188 | 187 | $replacement['key'] = key(self::$replacement); |
@@ -192,8 +191,7 @@ discard block |
||
192 | 191 | { |
193 | 192 | $replacement = false; |
194 | 193 | } |
195 | - } |
|
196 | - else |
|
194 | + } else |
|
197 | 195 | { |
198 | 196 | $new_source .= $token[1]; |
199 | 197 | } |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use PhpParser\Node\Name; |
16 | 16 | use PhpParser\Node\Name\FullyQualified; |
17 | 17 | use PhpParser\NodeVisitorAbstract; |
18 | - |
|
19 | 18 | use Kenjis\MonkeyPatch\Patcher\ConstantPatcher; |
20 | 19 | |
21 | 20 | class NodeVisitor extends NodeVisitorAbstract |
@@ -13,14 +13,9 @@ |
||
13 | 13 | class_alias('Kenjis\MonkeyPatch\Patcher\ConstantPatcher\Proxy', '__ConstProxy__'); |
14 | 14 | |
15 | 15 | use LogicException; |
16 | -use ReflectionConstant; |
|
17 | -use ReflectionException; |
|
18 | - |
|
19 | 16 | use Kenjis\MonkeyPatch\Patcher\ConstantPatcher; |
20 | 17 | use Kenjis\MonkeyPatch\Patcher\Backtrace; |
21 | 18 | use Kenjis\MonkeyPatch\MonkeyPatchManager; |
22 | -use Kenjis\MonkeyPatch\Cache; |
|
23 | -use Kenjis\MonkeyPatch\InvocationVerifier; |
|
24 | 19 | |
25 | 20 | class Proxy |
26 | 21 | { |
@@ -14,7 +14,6 @@ |
||
14 | 14 | require __DIR__ . '/FunctionPatcher/Proxy.php'; |
15 | 15 | |
16 | 16 | use LogicException; |
17 | - |
|
18 | 17 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher\NodeVisitor; |
19 | 18 | |
20 | 19 | class FunctionPatcher extends AbstractPatcher |
@@ -181,8 +181,7 @@ discard block |
||
181 | 181 | if (is_string($token)) |
182 | 182 | { |
183 | 183 | $new_source .= $token; |
184 | - } |
|
185 | - elseif ($i == $replacement['key']) |
|
184 | + } elseif ($i == $replacement['key']) |
|
186 | 185 | { |
187 | 186 | $new_source .= $replacement['value']; |
188 | 187 | $replacement['key'] = key(self::$replacement); |
@@ -192,8 +191,7 @@ discard block |
||
192 | 191 | { |
193 | 192 | $replacement = false; |
194 | 193 | } |
195 | - } |
|
196 | - else |
|
194 | + } else |
|
197 | 195 | { |
198 | 196 | $new_source .= $token[1]; |
199 | 197 | } |
@@ -21,15 +21,11 @@ |
||
21 | 21 | |
22 | 22 | namespace Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
23 | 23 | |
24 | -use ReflectionFunction; |
|
25 | -use ReflectionException; |
|
26 | - |
|
27 | 24 | use PhpParser\Node; |
28 | 25 | use PhpParser\Node\Expr\FuncCall; |
29 | 26 | use PhpParser\Node\Name; |
30 | 27 | use PhpParser\Node\Name\FullyQualified; |
31 | 28 | use PhpParser\NodeVisitorAbstract; |
32 | - |
|
33 | 29 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
34 | 30 | |
35 | 31 | class NodeVisitor extends NodeVisitorAbstract |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use LogicException; |
16 | 16 | use ReflectionFunction; |
17 | 17 | use ReflectionException; |
18 | - |
|
19 | 18 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
20 | 19 | use Kenjis\MonkeyPatch\Patcher\Backtrace; |
21 | 20 | use Kenjis\MonkeyPatch\MonkeyPatchManager; |
@@ -13,8 +13,6 @@ |
||
13 | 13 | require __DIR__ . '/MethodPatcher/NodeVisitor.php'; |
14 | 14 | require __DIR__ . '/MethodPatcher/PatchManager.php'; |
15 | 15 | |
16 | -use LogicException; |
|
17 | - |
|
18 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher\NodeVisitor; |
19 | 17 | |
20 | 18 | class MethodPatcher extends AbstractPatcher |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | if(self::isVoidFunction($tokens, $key)){ |
68 | 68 | $new_source .= '{ ' . self::CODENORET; |
69 | - } |
|
70 | - else{ |
|
69 | + } else{ |
|
71 | 70 | $new_source .= '{ ' . self::CODE; |
72 | 71 | } |
73 | 72 | $start_method = false; |
@@ -78,13 +77,11 @@ discard block |
||
78 | 77 | { |
79 | 78 | $replacement = false; |
80 | 79 | } |
81 | - } |
|
82 | - else |
|
80 | + } else |
|
83 | 81 | { |
84 | 82 | $new_source .= $token; |
85 | 83 | } |
86 | - } |
|
87 | - else |
|
84 | + } else |
|
88 | 85 | { |
89 | 86 | $new_source .= $token[1]; |
90 | 87 | } |
@@ -13,7 +13,6 @@ |
||
13 | 13 | use PhpParser\Node; |
14 | 14 | use PhpParser\Node\Stmt\ClassMethod; |
15 | 15 | use PhpParser\NodeVisitorAbstract; |
16 | - |
|
17 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher; |
18 | 17 | |
19 | 18 | class NodeVisitor extends NodeVisitorAbstract |