File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ public function hasMetFunctionRequirements(): bool
112112 */
113113 public function getMissingRequirements (): array
114114 {
115- return array_filter ($ this ->requiredFunctions , function ($ function ) {
115+ return array_values ( array_filter ($ this ->requiredFunctions , function ($ function ) {
116116 foreach ($ this ->getRequiredUsages () as $ usage ) {
117117 if (!$ usage ->name instanceof Node \Name) {
118118 continue ;
@@ -123,6 +123,6 @@ public function getMissingRequirements(): array
123123 }
124124 }
125125 return true ;
126- });
126+ })) ;
127127 }
128128}
Original file line number Diff line number Diff line change @@ -50,4 +50,15 @@ public function testBannedUsagesAreNotRecorded(): void
5050 $ this ->assertFalse ($ visitor ->hasUsedBannedFunctions ());
5151 $ this ->assertSame ([], $ visitor ->getBannedUsages ());
5252 }
53+
54+ public function testLeaveNodeWithMultipleRequirements (): void
55+ {
56+ $ node = new FuncCall (new Name ('file ' ));
57+ $ visitor = new FunctionVisitor (['file ' , 'file_get_contents ' ], []);
58+ $ visitor ->leaveNode ($ node );
59+
60+ $ this ->assertSame ([$ node ], $ visitor ->getRequiredUsages ());
61+ $ this ->assertFalse ($ visitor ->hasMetFunctionRequirements ());
62+ $ this ->assertSame (['file_get_contents ' ], $ visitor ->getMissingRequirements ());
63+ }
5364}
You can’t perform that action at this time.
0 commit comments