Completed
Push — master ( e44546...d89722 )
by Kenji
43s
created
application/tests/_ci_phpunit_test/patcher/4.5/Patcher/FunctionPatcher.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
 
11 11
 namespace Kenjis\MonkeyPatch\Patcher;
12 12
 
13
-require __DIR__ . '/FunctionPatcher/NodeVisitor.php';
14
-require __DIR__ . '/FunctionPatcher/Proxy.php';
13
+require __DIR__.'/FunctionPatcher/NodeVisitor.php';
14
+require __DIR__.'/FunctionPatcher/Proxy.php';
15 15
 
16 16
 use LogicException;
17 17
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@  discard block
 block discarded – undo
72 72
 			if (is_string($token))
73 73
 			{
74 74
 				$new_source .= $token;
75
-			}
76
-			elseif (isset($replacement['key']) && $i == $replacement['key'])
75
+			} elseif (isset($replacement['key']) && $i == $replacement['key'])
77 76
 			{
78 77
 				$new_source .= $replacement['value'];
79 78
 				$replacement['key'] = key(self::$replacement);
@@ -83,8 +82,7 @@  discard block
 block discarded – undo
83 82
 				{
84 83
 					$replacement = false;
85 84
 				}
86
-			}
87
-			else
85
+			} else
88 86
 			{
89 87
 				$new_source .= $token[1];
90 88
 			}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/4.5/Patcher/ExitPatcher.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 namespace Kenjis\MonkeyPatch\Patcher;
12 12
 
13
-require __DIR__ . '/../Exception/ExitException.php';
13
+require __DIR__.'/../Exception/ExitException.php';
14 14
 
15 15
 class ExitPatcher
16 16
 {
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 			}
31 31
 			elseif ($token[0] === T_EXIT)
32 32
 			{
33
-				if ($tokens[$i+1] === ';')
33
+				if ($tokens[$i + 1] === ';')
34 34
 				{
35 35
 					$new_source .= 'exit__()';
36 36
 				}
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,20 +27,17 @@
 block discarded – undo
27 27
 			if (is_string($token))
28 28
 			{
29 29
 				$new_source .= $token;
30
-			}
31
-			elseif ($token[0] === T_EXIT)
30
+			} elseif ($token[0] === T_EXIT)
32 31
 			{
33 32
 				if ($tokens[$i+1] === ';')
34 33
 				{
35 34
 					$new_source .= 'exit__()';
36
-				}
37
-				else
35
+				} else
38 36
 				{
39 37
 					$new_source .= 'exit__';
40 38
 				}
41 39
 				$patched = true;
42
-			}
43
-			else
40
+			} else
44 41
 			{
45 42
 				$new_source .= $token[1];
46 43
 			}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/4.5/Patcher/ConstantPatcher.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
 
11 11
 namespace Kenjis\MonkeyPatch\Patcher;
12 12
 
13
-require __DIR__ . '/ConstantPatcher/NodeVisitor.php';
14
-require __DIR__ . '/ConstantPatcher/Proxy.php';
13
+require __DIR__.'/ConstantPatcher/NodeVisitor.php';
14
+require __DIR__.'/ConstantPatcher/Proxy.php';
15 15
 
16 16
 use LogicException;
17 17
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@  discard block
 block discarded – undo
72 72
 			if (is_string($token))
73 73
 			{
74 74
 				$new_source .= $token;
75
-			}
76
-			elseif (isset($replacement['key']) && $i == $replacement['key'])
75
+			} elseif (isset($replacement['key']) && $i == $replacement['key'])
77 76
 			{
78 77
 				$new_source .= $replacement['value'];
79 78
 				$replacement['key'] = key(self::$replacement);
@@ -83,8 +82,7 @@  discard block
 block discarded – undo
83 82
 				{
84 83
 					$replacement = false;
85 84
 				}
86
-			}
87
-			else
85
+			} else
88 86
 			{
89 87
 				$new_source .= $token[1];
90 88
 			}
Please login to merge, or discard this patch.
tests/_ci_phpunit_test/patcher/4.5/Patcher/FunctionPatcher/Proxy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			self::outputMessage($msg);
52 52
 			throw new LogicException($msg);
53 53
 		}
54
-		if (! FunctionPatcher::isWhitelisted($function))
54
+		if ( ! FunctionPatcher::isWhitelisted($function))
55 55
 		{
56 56
 			$msg = "<red>Can't patch on '$function'. It is not in whitelist. If you want to patch it, please add it to 'functions_to_patch' in 'tests/Bootstrap.php'. But note that there are some limitations. See <https://github.com/kenjis/ci-phpunit-test/blob/master/docs/HowToWriteTests.md#patching-functions> for details.</red>";
57 57
 			self::outputMessage($msg);
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 			$line = $info['line'];
98 98
 			$method = isset($info['class_method']) ? $info['class_method'] : $info['function'];
99 99
 
100
-			$log_args = function () use ($arguments) {
100
+			$log_args = function() use ($arguments) {
101 101
 				$output = '';
102 102
 				foreach ($arguments as $arg) {
103
-					$output .= var_export($arg, true) . ', ';
103
+					$output .= var_export($arg, true).', ';
104 104
 				}
105 105
 				$output = rtrim($output, ', ');
106 106
 				return $output;
107 107
 			};
108 108
 			MonkeyPatchManager::log(
109
-				'invoke_func: ' . $function . '(' . $log_args() . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()'
109
+				'invoke_func: '.$function.'('.$log_args().') on line '.$line.' in '.$file.' by '.$method.'()'
110 110
 			);
111 111
 		}
112 112
 	}
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 
149 149
 		if (isset(self::$patches_to_apply[$function]))
150 150
 		{
151
-			if (! self::checkCalledMethod($function))
151
+			if ( ! self::checkCalledMethod($function))
152 152
 			{
153 153
 				MonkeyPatchManager::log(
154
-					'invoke_func: ' . $function . '() not patched (out of scope)'
154
+					'invoke_func: '.$function.'() not patched (out of scope)'
155 155
 				);
156 156
 				self::checkPassedByReference($function);
157 157
 				return call_user_func_array($function, $arguments);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 		if (array_key_exists($function, self::$patches))
162 162
 		{
163
-			MonkeyPatchManager::log('invoke_func: ' . $function . '() patched');
163
+			MonkeyPatchManager::log('invoke_func: '.$function.'() patched');
164 164
 
165 165
 			if (is_callable(self::$patches[$function]))
166 166
 			{
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		}
179 179
 
180 180
 		MonkeyPatchManager::log(
181
-			'invoke_func: ' . $function . '() not patched (no patch)'
181
+			'invoke_func: '.$function.'() not patched (no patch)'
182 182
 		);
183 183
 		self::checkPassedByReference($function);
184 184
 		return call_user_func_array($function, $arguments);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$msg = str_replace(
232 232
 			['<red>', '</red>'], [$red_begin, $red_end], $msg
233 233
 		);
234
-		echo $msg . "\n";
234
+		echo $msg."\n";
235 235
 	}
236 236
 
237 237
 	/**
Please login to merge, or discard this patch.
tests/_ci_phpunit_test/patcher/4.5/Patcher/FunctionPatcher/NodeVisitor.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 {
37 37
 	public function leaveNode(Node $node)
38 38
 	{
39
-		if (! ($node instanceof FuncCall))
39
+		if ( ! ($node instanceof FuncCall))
40 40
 		{
41 41
 			return;
42 42
 		}
43 43
 
44
-		if (! ($node->name instanceof Name))
44
+		if ( ! ($node->name instanceof Name))
45 45
 		{
46 46
 			return;
47 47
 		}
48 48
 
49
-		if (! $node->name->isUnqualified())
49
+		if ( ! $node->name->isUnqualified())
50 50
 		{
51 51
 			return;
52 52
 		}
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 			FunctionPatcher::isWhitelisted((string) $node->name)
56 56
 			&& ! FunctionPatcher::isBlacklisted((string) $node->name)
57 57
 		) {
58
-			$replacement = new FullyQualified('\__FuncProxy__::' . (string) $node->name);
58
+			$replacement = new FullyQualified('\__FuncProxy__::'.(string) $node->name);
59 59
 
60 60
 			$pos = $node->getAttribute('startTokenPos');
61 61
 			FunctionPatcher::$replacement[$pos] = 
62
-				'\__FuncProxy__::' . (string) $node->name;
62
+				'\__FuncProxy__::'.(string) $node->name;
63 63
 
64 64
 			$node->name = $replacement;
65 65
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/4.5/Patcher/MethodPatcher.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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--;
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
tests/_ci_phpunit_test/patcher/4.5/Patcher/ConstantPatcher/Proxy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
tests/_ci_phpunit_test/patcher/4.5/Patcher/ConstantPatcher/NodeVisitor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public function enterNode(Node $node)
26 26
 	{
27
-		$callback = [$this, 'before' . ucfirst($node->getType())];
27
+		$callback = [$this, 'before'.ucfirst($node->getType())];
28 28
 		if (is_callable($callback)) {
29 29
 			call_user_func_array($callback, [$node]);
30 30
 		}
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function leaveNode(Node $node)
34 34
 	{
35
-		if (! ($node instanceof ConstFetch))
35
+		if ( ! ($node instanceof ConstFetch))
36 36
 		{
37
-			$callback = [$this, 'rewrite' . ucfirst($node->getType())];
37
+			$callback = [$this, 'rewrite'.ucfirst($node->getType())];
38 38
 			if (is_callable($callback)) {
39 39
 				call_user_func_array($callback, [$node]);
40 40
 			}
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
 			return;
48 48
 		}
49 49
 
50
-		if (! ($node->name instanceof Name))
50
+		if ( ! ($node->name instanceof Name))
51 51
 		{
52 52
 			return;
53 53
 		}
54 54
 
55
-		if (! $node->name->isUnqualified())
55
+		if ( ! $node->name->isUnqualified())
56 56
 		{
57 57
 			return;
58 58
 		}
59 59
 
60
-		if (! ConstantPatcher::isBlacklisted((string) $node->name))
60
+		if ( ! ConstantPatcher::isBlacklisted((string) $node->name))
61 61
 		{
62
-			$replacement = new FullyQualified('\__ConstProxy__::get(\'' . (string) $node->name . '\')');
62
+			$replacement = new FullyQualified('\__ConstProxy__::get(\''.(string) $node->name.'\')');
63 63
 
64 64
 			$pos = $node->getAttribute('startTokenPos');
65 65
 			ConstantPatcher::$replacement[$pos] = 
66
-				'\__ConstProxy__::get(\'' . (string) $node->name .'\')';
66
+				'\__ConstProxy__::get(\''.(string) $node->name.'\')';
67 67
 
68 68
 			$node->name = $replacement;
69 69
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/bootstrap.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,16 +19,13 @@
 block discarded – undo
19 19
 	if ($phpParserVersion->isGreaterThanOrEqualTo('4.6')) {
20 20
 		// PHP-Parser 4.6 -
21 21
 		require __DIR__ . '/4.x/MonkeyPatchManager.php';
22
-	}
23
-	elseif ($phpParserVersion->isGreaterThanOrEqualTo('4.0')) {
22
+	} elseif ($phpParserVersion->isGreaterThanOrEqualTo('4.0')) {
24 23
 		// PHP-Parser 4.0 - 4.5
25 24
 		require __DIR__ . '/4.5/MonkeyPatchManager.php';
26
-	}
27
-	elseif ($phpParserVersion->isGreaterThanOrEqualTo('3.0')) {
25
+	} elseif ($phpParserVersion->isGreaterThanOrEqualTo('3.0')) {
28 26
 		// PHP-Parser 3.x
29 27
 		require __DIR__ . '/3.x/MonkeyPatchManager.php';
30
-	}
31
-	else {
28
+	} else {
32 29
 		// PHP-Parser 2.x
33 30
 		require __DIR__ . '/2.x/MonkeyPatchManager.php';
34 31
 	}
Please login to merge, or discard this patch.