Skip to content

Commit

Permalink
CallFinder: Skip first-class callables
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Nov 1, 2022
1 parent a0e2ffa commit 8858392
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Binary file modified build/kint.phar
Binary file not shown.
5 changes: 5 additions & 0 deletions src/CallFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ public static function getFunctionCalls(string $source, int $line, $function): a
];
}

// Skip first-class callables
if (KINT_PHP81 && 1 === \count($params) && '...' === $param['path']) {
continue;
}

// Get the modifiers
--$index;

Expand Down
22 changes: 22 additions & 0 deletions tests/CallFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,28 @@ public function sourceProvider()
];
}

if (KINT_PHP81) {
$data['ignore firstclass callables'] = [
'<?php
$x = test(...); test($a);',
'line' => 3,
'function' => 'test',
'result' => [
[
'modifiers' => [],
'parameters' => [
[
'path' => '$a',
'name' => '$a',
'expression' => false,
],
],
],
],
];
}

if (KINT_PHP82) {
$data['dnf types'] = [
'<?php
Expand Down

0 comments on commit 8858392

Please sign in to comment.