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

File::getMethodParameters() setting typeHintEndToken for vars with no type hint #2685

Merged

Commits on Nov 10, 2019

  1. File::getMethodParameters(): fix incorrect $typeHintEndToken

    Given the following code sample:
    ```php
    function foo( ?bool $a, $b ) {}
    ```
    
    In the resulting array, the second parameter `$b` will have the 'type_hint_end_token' set to the stack pointer for the end of the type declaration for `$a`.
    
    Caused by the `$typeHintEndToken` not being reset for the next parameter.
    
    I've re-ordered the variable reset now to be the same as the order used for the initial variable declarations before the loop to make it more obvious.
    
    While not necessarily a bug, the `$currVar` variable was also not being reset. That's also been fixed now.
    
    I've not added a unit test as the existing tests do not check the token positions in the array.
    jrfnl committed Nov 10, 2019
    Copy the full SHA
    1b96fdb View commit details
    Browse the repository at this point in the history