Skip to content

Add support for native function imports #88

Description

@smrhoney

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions