Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for native function imports #88

Open
smrhoney opened this issue Jul 27, 2021 · 0 comments
Open

Add support for native function imports #88

smrhoney opened this issue Jul 27, 2021 · 0 comments

Comments

@smrhoney
Copy link

smrhoney commented Jul 27, 2021

The following code fails to scan due to line 6 (use function usort).

<?php
namespace Demo;

use function strlen;
use function usort;
use function var_dump;


$data = [
    "test-one",
    "test-three",
    "test-two",
    "test-four",
];

$sortCallback = function ($a, $b) {
    $lA = strlen($a);
    $lB = strlen($b);

    if ($lA == $lB) {
        return 0;
    }

    return  $lA < $lB ? -1 : 1;
};

usort($data, $sortCallback);
var_dump($data);

Getting error: An error occurred during processing; checking has been aborted.
The error message was: Undefined index: parenthesis_closer in
...\Sniffs\BadFunctions\CallbackFunctionsSniff.php on line 34

Can you allow for native function imports?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant