2525use Humbug \PhpScoper \Symbol \SymbolsRegistry ;
2626use LogicException ;
2727use PhpParser \Error as PhpParserError ;
28+ use PhpParser \Lexer ;
2829use PhpParser \Node \Name ;
2930use PhpParser \NodeTraverserInterface ;
3031use PhpParser \Parser ;
@@ -68,6 +69,8 @@ class PhpScoperTest extends TestCase
6869 private SymbolsRegistry $ symbolsRegistry ;
6970
7071 private Printer $ printer ;
72+
73+ private Lexer $ lexer ;
7174
7275 protected function setUp (): void
7376 {
@@ -83,6 +86,11 @@ protected function setUp(): void
8386 $ this ->symbolsRegistry = new SymbolsRegistry ();
8487 $ this ->printer = new StandardPrinter (new Standard ());
8588
89+ $ lexerProphecy = $ this ->prophesize (Lexer::class);
90+ $ lexerProphecy ->getTokens ()->willReturn ([]);
91+
92+ $ this ->lexer = $ lexerProphecy ->reveal ();
93+
8694 $ this ->scoper = new PhpScoper (
8795 create_parser (),
8896 new FakeScoper (),
@@ -95,6 +103,7 @@ protected function setUp(): void
95103 $ this ->symbolsRegistry ,
96104 ),
97105 $ this ->printer ,
106+ $ this ->lexer ,
98107 );
99108 }
100109
@@ -147,6 +156,7 @@ public function test_does_not_scope_file_if_is_not_a_PHP_file(): void
147156 $ this ->decoratedScoper ,
148157 $ this ->traverserFactory ,
149158 new FakePrinter (),
159+ $ this ->lexer ,
150160 );
151161
152162 $ actual = $ scoper ->scope ($ filePath , $ fileContents );
@@ -234,6 +244,7 @@ public function test_does_not_scope_a_non_PHP_executable_files(): void
234244 $ this ->decoratedScoper ,
235245 $ this ->traverserFactory ,
236246 new FakePrinter (),
247+ $ this ->lexer ,
237248 );
238249
239250 $ actual = $ scoper ->scope ($ filePath , $ contents );
@@ -332,6 +343,7 @@ static function () use (&$i): bool {
332343 new FakeScoper (),
333344 $ this ->traverserFactory ,
334345 $ this ->printer ,
346+ $ this ->lexer ,
335347 );
336348
337349 foreach ($ files as $ file => $ contents ) {
0 commit comments