@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
12 | 12 | |
13 | -require __DIR__ . '/MethodPatcher/NodeVisitor.php'; |
|
14 | -require __DIR__ . '/MethodPatcher/PatchManager.php'; |
|
13 | +require __DIR__.'/MethodPatcher/NodeVisitor.php'; |
|
14 | +require __DIR__.'/MethodPatcher/PatchManager.php'; |
|
15 | 15 | |
16 | 16 | use LogicException; |
17 | 17 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | { |
65 | 65 | if ($start_method && $token === '{') |
66 | 66 | { |
67 | - if(self::isVoidFunction($tokens, $key)){ |
|
68 | - $new_source .= '{ ' . self::CODENORET; |
|
67 | + if (self::isVoidFunction($tokens, $key)) { |
|
68 | + $new_source .= '{ '.self::CODENORET; |
|
69 | 69 | } |
70 | - else{ |
|
71 | - $new_source .= '{ ' . self::CODE; |
|
70 | + else { |
|
71 | + $new_source .= '{ '.self::CODE; |
|
72 | 72 | } |
73 | 73 | $start_method = false; |
74 | 74 | $replacement['key'] = key(self::$replacement); |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | * @param $key |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - protected static function isVoidFunction($tokens, $key){ |
|
104 | - if($key - 1 <= 0){ |
|
103 | + protected static function isVoidFunction($tokens, $key) { |
|
104 | + if ($key - 1 <= 0) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | $token = $tokens[$key - 1]; |
108 | - if(is_array($token)){ |
|
108 | + if (is_array($token)) { |
|
109 | 109 | $token = $token[1]; |
110 | 110 | } |
111 | 111 | //Loop backwards though the start of the function block till you either find "void" or the end of the |
112 | 112 | //parameters declaration. |
113 | - while($token !== ")"){ |
|
114 | - if(strpos($token, "void") !== false){ |
|
113 | + while ($token !== ")") { |
|
114 | + if (strpos($token, "void") !== false) { |
|
115 | 115 | return true; |
116 | 116 | } |
117 | 117 | $token = $tokens[$key - 1]; |
118 | - if(is_array($token)){ |
|
118 | + if (is_array($token)) { |
|
119 | 119 | $token = $token[1]; |
120 | 120 | } |
121 | 121 | $key--; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
64 | 64 | |
65 | 65 | MonkeyPatchManager::log( |
66 | - 'invoke_const: ' . $constant . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
66 | + 'invoke_const: '.$constant.') on line '.$line.' in '.$file.' by '.$method.'()' |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | } |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | { |
107 | 107 | self::logInvocation($constant); |
108 | 108 | |
109 | - if (! empty(self::$patches_to_apply[$constant])) |
|
109 | + if ( ! empty(self::$patches_to_apply[$constant])) |
|
110 | 110 | { |
111 | - if (! self::checkCalledMethod($constant)) |
|
111 | + if ( ! self::checkCalledMethod($constant)) |
|
112 | 112 | { |
113 | 113 | MonkeyPatchManager::log( |
114 | - 'invoke_const: ' . $constant . ' not patched (out of scope)' |
|
114 | + 'invoke_const: '.$constant.' not patched (out of scope)' |
|
115 | 115 | ); |
116 | 116 | return constant($constant); |
117 | 117 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | if (array_key_exists($constant, self::$patches)) |
121 | 121 | { |
122 | - MonkeyPatchManager::log('invoke_const: ' . $constant . ' patched'); |
|
122 | + MonkeyPatchManager::log('invoke_const: '.$constant.' patched'); |
|
123 | 123 | return self::$patches[$constant]; |
124 | 124 | } |
125 | 125 | |
126 | 126 | MonkeyPatchManager::log( |
127 | - 'invoke_const: ' . $constant . ' not patched (no patch)' |
|
127 | + 'invoke_const: '.$constant.' not patched (no patch)' |
|
128 | 128 | ); |
129 | 129 | return constant($constant); |
130 | 130 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | use Kenjis\MonkeyPatch\PhpParserVersion; |
12 | 12 | |
13 | -require __DIR__ . '/PhpParserVersion.php'; |
|
13 | +require __DIR__.'/PhpParserVersion.php'; |
|
14 | 14 | |
15 | 15 | $phpParserVersion = new PhpParserVersion(); |
16 | 16 | |
@@ -18,41 +18,41 @@ discard block |
||
18 | 18 | if ($phpParserVersion->isComposerInstalled()) { |
19 | 19 | if ($phpParserVersion->isGreaterThanOrEqualTo('4.6')) { |
20 | 20 | // PHP-Parser 4.6 - |
21 | - require __DIR__ . '/4.x/MonkeyPatchManager.php'; |
|
21 | + require __DIR__.'/4.x/MonkeyPatchManager.php'; |
|
22 | 22 | } |
23 | 23 | elseif ($phpParserVersion->isGreaterThanOrEqualTo('4.0')) { |
24 | 24 | // PHP-Parser 4.0 - 4.5 |
25 | - require __DIR__ . '/4.5/MonkeyPatchManager.php'; |
|
25 | + require __DIR__.'/4.5/MonkeyPatchManager.php'; |
|
26 | 26 | } |
27 | 27 | elseif ($phpParserVersion->isGreaterThanOrEqualTo('3.0')) { |
28 | 28 | // PHP-Parser 3.x |
29 | - require __DIR__ . '/3.x/MonkeyPatchManager.php'; |
|
29 | + require __DIR__.'/3.x/MonkeyPatchManager.php'; |
|
30 | 30 | } |
31 | 31 | else { |
32 | 32 | // PHP-Parser 2.x |
33 | - require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
|
33 | + require __DIR__.'/2.x/MonkeyPatchManager.php'; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | // If you don't use Composer |
37 | 37 | else { |
38 | 38 | if (version_compare(PHP_VERSION, '5.5.0', '>=')) { |
39 | 39 | // Use PHP-Parser 3.x |
40 | - require __DIR__ . '/third_party/PHP-Parser-3.1.5/lib/bootstrap.php'; |
|
41 | - require __DIR__ . '/3.x/MonkeyPatchManager.php'; |
|
40 | + require __DIR__.'/third_party/PHP-Parser-3.1.5/lib/bootstrap.php'; |
|
41 | + require __DIR__.'/3.x/MonkeyPatchManager.php'; |
|
42 | 42 | } else { |
43 | 43 | // Use PHP-Parser 2.x |
44 | - require __DIR__ . '/third_party/PHP-Parser-2.1.1/lib/bootstrap.php'; |
|
45 | - require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
|
44 | + require __DIR__.'/third_party/PHP-Parser-2.1.1/lib/bootstrap.php'; |
|
45 | + require __DIR__.'/2.x/MonkeyPatchManager.php'; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -require __DIR__ . '/IncludeStream.php'; |
|
50 | -require __DIR__ . '/PathChecker.php'; |
|
51 | -require __DIR__ . '/MonkeyPatch.php'; |
|
52 | -require __DIR__ . '/Cache.php'; |
|
53 | -require __DIR__ . '/InvocationVerifier.php'; |
|
49 | +require __DIR__.'/IncludeStream.php'; |
|
50 | +require __DIR__.'/PathChecker.php'; |
|
51 | +require __DIR__.'/MonkeyPatch.php'; |
|
52 | +require __DIR__.'/Cache.php'; |
|
53 | +require __DIR__.'/InvocationVerifier.php'; |
|
54 | 54 | |
55 | -require __DIR__ . '/functions/exit__.php'; |
|
55 | +require __DIR__.'/functions/exit__.php'; |
|
56 | 56 | |
57 | 57 | const __GO_TO_ORIG__ = '__GO_TO_ORIG__'; |
58 | 58 |