You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "Found '{$result->node->name()}' on line {$result->location->startLine}" . PHP_EOL;
@@ -81,14 +86,10 @@ foreach($results->results as $result) {
81
86
To search for function calls or definitions, use the `functions` method. Regular expressions can be used by surrounding the name with slashes `/`, i.e. `/test\d+/`.
82
87
83
88
```php
84
-
// this will search for references AND definitions for 'strtolower' and 'myfunc'
85
-
$results = $searcher
89
+
// search for references AND definitions for 'strtolower' and/or 'myfunc'
90
+
$searcher
86
91
->functions(['strtolower', 'myfunc'])
87
-
->search('./file1.php');
88
-
89
-
foreach($results->results as $result) {
90
-
echo "Found '{$result->node->name()}' on line {$result->location->startLine}" . PHP_EOL;
91
-
}
92
+
->search('file1.php');
92
93
```
93
94
94
95
### Method calls
@@ -101,9 +102,10 @@ Method call nodes have an `args` property that can be looped through to retrieve
101
102
$results = $searcher
102
103
->methods(['/test(One|Two)/'])
103
104
->searchCode('<?php '.
104
-
' $obj->testOne("hello world 1"); '.
105
-
' $obj->testTwo("hello world", 2); '.
106
-
'');
105
+
' $obj->testOne("hello world 1"); '.
106
+
' $obj->testTwo("hello world", 2); '.
107
+
''
108
+
);
107
109
108
110
foreach($results->results as $result) {
109
111
echo "Found '{$result->node->name()}' on line {$result->location->startLine}" . PHP_EOL;
@@ -121,21 +123,17 @@ To search for static method or property calls, use the `static` method before ca
121
123
Valid search terms are either a class name like `Cache`, or a class name and a method name like `Cache::remember`.
echo "Found '{$result->node->name()}' on line {$result->location->startLine}" . PHP_EOL;
130
-
}
131
129
```
132
130
133
131
### Classes
134
132
135
133
To search for either a class definition or a class created by the `new` keyword, use the `classes`. Regular expression patterns are supported by surrounding a value with slashes `/`.
0 commit comments