| @@ 64-87 (lines=24) @@ | ||
| 61 | }); |
|
| 62 | } |
|
| 63 | ||
| 64 | protected function register_func_call_listener(ListenerRegistry $registry) { |
|
| 65 | $registry->on_enter_misc |
|
| 66 | ( array(N\Expr\FuncCall::class) |
|
| 67 | , function(Insert $insert, Location $location, \PhpParser\Node $node) { |
|
| 68 | // Omit calls to closures, we would not be able to |
|
| 69 | // analyze them anyway atm. |
|
| 70 | // Omit functions in arrays, we would not be able to |
|
| 71 | // analyze them anyway atm. |
|
| 72 | if (!($node->name instanceof N\Expr\Variable || |
|
| 73 | $node->name instanceof N\Expr\ArrayDimFetch)) { |
|
| 74 | $ref_id = $insert->get_reference |
|
| 75 | ( Variable::FUNCTION_TYPE |
|
| 76 | , $node->name->parts[0] |
|
| 77 | , $location->file_path() |
|
| 78 | , $node->getAttribute("startLine") |
|
| 79 | ); |
|
| 80 | $this->insert_relation_into |
|
| 81 | ( $insert |
|
| 82 | , $location |
|
| 83 | , $ref_id |
|
| 84 | ); |
|
| 85 | } |
|
| 86 | }); |
|
| 87 | } |
|
| 88 | ||
| 89 | protected function register_global_listener(ListenerRegistry $registry) { |
|
| 90 | $registry->on_enter_misc |
|
| @@ 60-83 (lines=24) @@ | ||
| 57 | }); |
|
| 58 | } |
|
| 59 | ||
| 60 | protected function register_method_call_listener(ListenerRegistry $registry) { |
|
| 61 | $registry->on_enter_misc |
|
| 62 | ( array(N\Expr\FuncCall::class) |
|
| 63 | , function(Insert $insert, Location $location, \PhpParser\Node $node) { |
|
| 64 | // Omit calls to closures, we would not be able to |
|
| 65 | // analyze them anyway atm. |
|
| 66 | // Omit functions in arrays, we would not be able to |
|
| 67 | // analyze them anyway atm. |
|
| 68 | if (!($node->name instanceof N\Expr\Variable || |
|
| 69 | $node->name instanceof N\Expr\ArrayDimFetch)) { |
|
| 70 | $ref_id = $insert->get_reference |
|
| 71 | ( Variable::FUNCTION_TYPE |
|
| 72 | , $node->name->parts[0] |
|
| 73 | , $location->file_path() |
|
| 74 | , $node->getAttribute("startLine") |
|
| 75 | ); |
|
| 76 | $this->insert_relation_into |
|
| 77 | ( $insert |
|
| 78 | , $location |
|
| 79 | , $ref_id |
|
| 80 | ); |
|
| 81 | } |
|
| 82 | }); |
|
| 83 | } |
|
| 84 | ||
| 85 | } |
|
| 86 | ||