Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/test/CodeCleaner/UseStatementPassTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 5fb285c0d0e3 |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
53 ], | 53 ], |
54 [ | 54 [ |
55 "namespace Foo;\nuse Bar;\n\$baz = new Bar\\Baz();", | 55 "namespace Foo;\nuse Bar;\n\$baz = new Bar\\Baz();", |
56 "namespace Foo;\n\n\$baz = new \\Bar\\Baz();", | 56 "namespace Foo;\n\n\$baz = new \\Bar\\Baz();", |
57 ], | 57 ], |
58 [ | |
59 "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();\nnamespace Foo;\n\n\$std = new S();", | |
60 "namespace Foo;\n\n\$std = new \\StdClass();\nnamespace Foo;\n\n\$std = new \\StdClass();", | |
61 ], | |
62 [ | |
63 "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();\nnamespace Bar;\n\n\$std = new S();", | |
64 "namespace Foo;\n\n\$std = new \\StdClass();\nnamespace Bar;\n\n\$std = new S();", | |
65 ], | |
66 [ | |
67 "use Foo\\Bar as fb, Qux as Q;\n\$baz = new fb\\Baz();\n\$qux = new Q();", | |
68 "\$baz = new \\Foo\\Bar\\Baz();\n\$qux = new \\Qux();", | |
69 ], | |
70 ]; | |
71 } | |
72 | |
73 /** | |
74 * @dataProvider groupUseStatements | |
75 */ | |
76 public function testGroupUseProcess($from, $to) | |
77 { | |
78 $this->assertProcessesAs($from, $to); | |
79 } | |
80 | |
81 public function groupUseStatements() | |
82 { | |
83 if (version_compare(PHP_VERSION, '7.0', '<')) { | |
84 $this->markTestSkipped(); | |
85 } | |
86 | |
87 return [ | |
88 [ | |
89 "use Foo\\{Bar, Baz, Qux as Q};\n\$bar = new Bar();\n\$baz = new Baz();\n\$qux = new Q();", | |
90 "\$bar = new \\Foo\\Bar();\n\$baz = new \\Foo\\Baz();\n\$qux = new \\Foo\\Qux();", | |
91 ], | |
92 [ | |
93 "use X\\{Foo, Bar as B};\n\$foo = new Foo();\n\$baz = new B\\Baz();", | |
94 "\$foo = new \\X\\Foo();\n\$baz = new \\X\\Bar\\Baz();", | |
95 ], | |
96 [ | |
97 "use X\\{Foo, Bar as B};\n\$foo = new Foo();\n\$bar = new Bar();\n\$baz = new B\\Baz();", | |
98 "\$foo = new \\X\\Foo();\n\$bar = new Bar();\n\$baz = new \\X\\Bar\\Baz();", | |
99 ], | |
58 ]; | 100 ]; |
59 } | 101 } |
60 } | 102 } |