File tree 2 files changed +13
-2
lines changed
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
112
112
*/
113
113
public function getMissingRequirements (): array
114
114
{
115
- return array_filter ($ this ->requiredFunctions , function ($ function ) {
115
+ return array_values ( array_filter ($ this ->requiredFunctions , function ($ function ) {
116
116
foreach ($ this ->getRequiredUsages () as $ usage ) {
117
117
if (!$ usage ->name instanceof Node \Name) {
118
118
continue ;
@@ -123,6 +123,6 @@ public function getMissingRequirements(): array
123
123
}
124
124
}
125
125
return true ;
126
- });
126
+ })) ;
127
127
}
128
128
}
Original file line number Diff line number Diff line change @@ -50,4 +50,15 @@ public function testBannedUsagesAreNotRecorded(): void
50
50
$ this ->assertFalse ($ visitor ->hasUsedBannedFunctions ());
51
51
$ this ->assertSame ([], $ visitor ->getBannedUsages ());
52
52
}
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
+ }
53
64
}
You can’t perform that action at this time.
0 commit comments