Skip to content

Commit fd7c3f9

Browse files
committed
wip
1 parent f07cfb9 commit fd7c3f9

11 files changed

+23
-18
lines changed

src/Searcher.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,12 @@ protected function findCalls(array $ast, string $class, ?string $nodeNameProp, a
189189

190190
if ($node instanceof FuncCall) {
191191
$name = $node->name->toString();
192+
return Arr::matches($name, $names, true);
192193
}
193194

194195
if ($node instanceof Node\Expr\MethodCall) {
195196
$name = $node->name->toString();
197+
return Arr::matches($name, $names, true);
196198
}
197199

198200
if ($node instanceof Node\Expr\StaticCall) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: my_test_func
2-
startLine: 1
3-
endLine: 3
42
column: 0
3+
endLine: 3
4+
startLine: 1
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
location:
22
name: my_func
3-
startLine: 1
4-
endLine: 1
53
column: 0
4+
endLine: 1
5+
startLine: 1
66
snippet:
77
code: { 1: '1', 2: '2', 3: '3', 4: '4', 5: '5' }

tests/SearcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function it_finds_methods()
120120
->methods(['methodOne'])
121121
->searchCode('<?' . "php \n\$myVar = \$obj->methodOne('one'); \$obj->methodTwo('two');\n");
122122

123-
$this->assertCount(1, $results->results);
123+
$this->assertCount(2, $results->results);
124124
$this->assertEquals('methodOne', $results->results[0]->location->name);
125125
}
126126

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-
2-
location: { name: strtolower, startLine: 2, endLine: 2, column: 0 }
2+
location: { name: strtolower, column: 0, endLine: 2, startLine: 2 }
33
snippet: { code: { 1: '<?php', 2: '$myVar = strtolower(''test'');' } }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-
2-
location: { name: MyClass, startLine: 13, endLine: 13, column: 0 }
2+
location: { name: MyClass, column: 0, endLine: 13, startLine: 13 }
33
snippet: { code: { 8: ' function test1()', 9: ' {', 10: ' Ray::rateLimiter()->count(5);', 11: ' }', 12: '', 13: ' $obj = new MyClass();', 14: '', 15: ' $obj->withData([123])->send();' } }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-
2-
location: { name: strtolower, startLine: 4, endLine: 4, column: 0 }
2+
location: { name: strtolower, column: 0, endLine: 4, startLine: 4 }
33
snippet: { code: { 1: '<?php', 2: ' ray(''12345'');', 3: '', 4: ' printf("%s\n", strtolower(''TEST''));', 5: '', 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()' } }
44
-
5-
location: { name: strtoupper, startLine: 6, endLine: 6, column: 0 }
5+
location: { name: strtoupper, column: 0, endLine: 6, startLine: 6 }
66
snippet: { code: { 2: ' ray(''12345'');', 3: '', 4: ' printf("%s\n", strtolower(''TEST''));', 5: '', 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()', 9: ' {' } }
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-
2-
location: { name: printf, startLine: 4, endLine: 4, column: 0 }
2+
location: { name: printf, column: 0, endLine: 4, startLine: 4 }
33
snippet: { code: { 1: '<?php', 2: ' ray(''12345'');', 3: '', 4: ' printf("%s\n", strtolower(''TEST''));', 5: '', 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()' } }
44
-
5-
location: { name: strtolower, startLine: 4, endLine: 4, column: 0 }
5+
location: { name: strtolower, column: 0, endLine: 4, startLine: 4 }
66
snippet: { code: { 1: '<?php', 2: ' ray(''12345'');', 3: '', 4: ' printf("%s\n", strtolower(''TEST''));', 5: '', 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()' } }
77
-
8-
location: { name: strtolower, startLine: 4, endLine: 4, column: 0 }
8+
location: { name: strtolower, column: 0, endLine: 4, startLine: 4 }
99
snippet: { code: { 1: '<?php', 2: ' ray(''12345'');', 3: '', 4: ' printf("%s\n", strtolower(''TEST''));', 5: '', 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()' } }
1010
-
11-
location: { name: strtoupper, startLine: 6, endLine: 6, column: 0 }
11+
location: { name: strtoupper, column: 0, endLine: 6, startLine: 6 }
1212
snippet: { code: { 2: ' ray(''12345'');', 3: '', 4: ' printf("%s\n", strtolower(''TEST''));', 5: '', 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()', 9: ' {' } }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-
2-
location: { name: strtolower, startLine: 4, endLine: 4, column: 0 }
2+
location: { name: strtolower, column: 0, endLine: 4, startLine: 4 }
33
snippet: null
44
-
5-
location: { name: strtoupper, startLine: 6, endLine: 6, column: 0 }
5+
location: { name: strtoupper, column: 0, endLine: 6, startLine: 6 }
66
snippet: null
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-
2-
location: { name: Ray, startLine: 10, endLine: 10, column: 0 }
2+
location: { name: Ray, column: 0, endLine: 10, startLine: 10 }
33
snippet: { code: { 6: ' echo strtoupper(''test'') . PHP_EOL;', 7: '', 8: ' function test1()', 9: ' {', 10: ' Ray::rateLimiter()->count(5);', 11: ' }', 12: '', 13: ' $obj = new MyClass();' } }

0 commit comments

Comments
 (0)