@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $this->$name; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - throw new LogicException('No such property: ' . $name); |
|
| 44 | + throw new LogicException('No such property: '.$name); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public static function setUpBeforeClass() |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | reset_instance(); |
| 63 | 63 | CIPHPUnitTest::createCodeIgniterInstance(); |
| 64 | - $this->CI =& get_instance(); |
|
| 64 | + $this->CI = & get_instance(); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function tearDown() |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $this->assertSame( |
| 237 | 237 | $code, |
| 238 | 238 | $actual, |
| 239 | - 'Status code is not ' . $code . ' but ' . $actual . '.' |
|
| 239 | + 'Status code is not '.$code.' but '.$actual.'.' |
|
| 240 | 240 | ); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public function assertResponseHeader($name, $value) |
| 250 | 250 | { |
| 251 | - $CI =& get_instance(); |
|
| 251 | + $CI = & get_instance(); |
|
| 252 | 252 | $actual = $CI->output->get_header($name); |
| 253 | 253 | |
| 254 | 254 | if ($actual === null) |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function assertResponseCookie($name, $value, $allow_duplicate = false) |
| 274 | 274 | { |
| 275 | - $CI =& get_instance(); |
|
| 275 | + $CI = & get_instance(); |
|
| 276 | 276 | $cookies = isset($CI->output->_cookies[$name]) |
| 277 | 277 | ? $CI->output->_cookies[$name] : null; |
| 278 | 278 | |
@@ -330,23 +330,23 @@ discard block |
||
| 330 | 330 | $this->fail('redirect() is not called.'); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if (! function_exists('site_url')) |
|
| 333 | + if ( ! function_exists('site_url')) |
|
| 334 | 334 | { |
| 335 | - $CI =& get_instance(); |
|
| 335 | + $CI = & get_instance(); |
|
| 336 | 336 | $CI->load->helper('url'); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if (! preg_match('#^(\w+:)?//#i', $uri)) |
|
| 339 | + if ( ! preg_match('#^(\w+:)?//#i', $uri)) |
|
| 340 | 340 | { |
| 341 | 341 | $uri = site_url($uri); |
| 342 | 342 | } |
| 343 | 343 | $absolute_url = $uri; |
| 344 | - $expected = 'Redirect to ' . $absolute_url; |
|
| 344 | + $expected = 'Redirect to '.$absolute_url; |
|
| 345 | 345 | |
| 346 | 346 | $this->assertSame( |
| 347 | 347 | $expected, |
| 348 | 348 | $status['redirect'], |
| 349 | - 'URL to redirect is not ' . $expected . ' but ' . $status['redirect'] . '.' |
|
| 349 | + 'URL to redirect is not '.$expected.' but '.$status['redirect'].'.' |
|
| 350 | 350 | ); |
| 351 | 351 | |
| 352 | 352 | if ($code !== null) |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $this->assertSame( |
| 355 | 355 | $code, |
| 356 | 356 | $status['code'], |
| 357 | - 'Status code is not ' . $code . ' but ' . $status['code'] . '.' |
|
| 357 | + 'Status code is not '.$code.' but '.$status['code'].'.' |
|
| 358 | 358 | ); |
| 359 | 359 | } |
| 360 | 360 | } |
@@ -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 |
@@ -24,7 +24,7 @@ discard block |
||
| 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 |
||
| 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,26 +47,26 @@ discard block |
||
| 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 | 62 | $replacement = new FullyQualified(array()); |
| 63 | 63 | $replacement->set( |
| 64 | - '\__ConstProxy__::get(\'' . (string) $node->name . '\')' |
|
| 64 | + '\__ConstProxy__::get(\''.(string) $node->name.'\')' |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | $pos = $node->getAttribute('startTokenPos'); |
| 68 | 68 | ConstantPatcher::$replacement[$pos] = |
| 69 | - '\__ConstProxy__::get(\'' . (string) $node->name .'\')'; |
|
| 69 | + '\__ConstProxy__::get(\''.(string) $node->name.'\')'; |
|
| 70 | 70 | |
| 71 | 71 | $node->name = $replacement; |
| 72 | 72 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
| 66 | 66 | |
| 67 | 67 | MonkeyPatchManager::log( |
| 68 | - 'invoke_const: ' . $constant . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
| 68 | + 'invoke_const: '.$constant.') on line '.$line.' in '.$file.' by '.$method.'()' |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if (isset(self::$patches_to_apply[$constant])) |
| 113 | 113 | { |
| 114 | - if (! self::checkCalledMethod($constant)) |
|
| 114 | + if ( ! self::checkCalledMethod($constant)) |
|
| 115 | 115 | { |
| 116 | 116 | MonkeyPatchManager::log( |
| 117 | - 'invoke_const: ' . $constant . ' not patched (out of scope)' |
|
| 117 | + 'invoke_const: '.$constant.' not patched (out of scope)' |
|
| 118 | 118 | ); |
| 119 | 119 | return constant($constant); |
| 120 | 120 | } |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | if (array_key_exists($constant, self::$patches)) |
| 124 | 124 | { |
| 125 | - MonkeyPatchManager::log('invoke_const: ' . $constant . ' patched'); |
|
| 125 | + MonkeyPatchManager::log('invoke_const: '.$constant.' patched'); |
|
| 126 | 126 | return self::$patches[$constant]; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | MonkeyPatchManager::log( |
| 130 | - 'invoke_const: ' . $constant . ' not patched (no patch)' |
|
| 130 | + 'invoke_const: '.$constant.' not patched (no patch)' |
|
| 131 | 131 | ); |
| 132 | 132 | return constant($constant); |
| 133 | 133 | } |
@@ -10,8 +10,8 @@ |
||
| 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 | |
@@ -173,13 +173,11 @@ |
||
| 173 | 173 | if (is_string($token)) |
| 174 | 174 | { |
| 175 | 175 | $new_source .= $token; |
| 176 | - } |
|
| 177 | - elseif ($i == $replacement['key']) |
|
| 176 | + } elseif ($i == $replacement['key']) |
|
| 178 | 177 | { |
| 179 | 178 | $new_source .= $replacement['value']; |
| 180 | 179 | $replacement = each(self::$replacement); |
| 181 | - } |
|
| 182 | - else |
|
| 180 | + } else |
|
| 183 | 181 | { |
| 184 | 182 | $new_source .= $token[1]; |
| 185 | 183 | } |