File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,31 @@ public function bar()
139139 $ this ->assertSame ([], $ context ->getNamespaceAliases ());
140140 }
141141
142+ public function testTraitContainsClosureWithUseStatement () : void
143+ {
144+ $ php = '<?php declare(strict_types=1);
145+ namespace Foo;
146+
147+ trait FooTrait {
148+ protected function check(array $data, string $key) : void
149+ {
150+ array_walk($data, function(&$item) use ($key) {
151+ // update item based on the key
152+ });
153+ }
154+ }
155+
156+ class FooClass {
157+ use FooTrait;
158+ }
159+ ' ;
160+
161+ $ fixture = new ContextFactory ();
162+ $ context = $ fixture ->createForNamespace ('Foo ' , $ php );
163+
164+ $ this ->assertSame ([], $ context ->getNamespaceAliases ());
165+ }
166+
142167 /**
143168 * @covers ::createFromReflector
144169 */
You can’t perform that action at this time.
0 commit comments