4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Test\CodeCleaner;
14 use Psy\CodeCleaner\ImplicitReturnPass;
16 class ImplicitReturnPassTest extends CodeCleanerTestCase
18 public function setUp()
20 $this->setPass(new ImplicitReturnPass());
24 * @dataProvider implicitReturns
26 public function testProcess($from, $to)
28 $this->assertProcessesAs($from, $to);
31 public function implicitReturns()
34 array('4', 'return 4;'),
35 array('foo()', 'return foo();'),
36 array('return 1', 'return 1;'),
39 $from = 'if (true) { 1; } elseif (true) { 2; } else { 3; }';
48 return new \Psy\CodeCleaner\NoReturnValue();
50 $values[] = array($from, $to);
57 return new \Psy\CodeCleaner\NoReturnValue();
59 $values[] = array($from, $to);
84 return new \Psy\CodeCleaner\NoReturnValue();
86 $values[] = array($from, $to);
88 if (version_compare(PHP_VERSION, '5.4', '<')) {
89 $values[] = array('exit()', 'die;');
91 $values[] = array('exit()', 'exit;');