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

Tokenizer/PHP: bug fix for static typed properties with union/intersection types #3867

Commits on Oct 29, 2023

  1. Tokenizer/PHP: bug fix for static typed properties with union/interse…

    …ction types
    
    Just like the `var` keyword, the `static` keyword can also be used stand-alone with property declarations.
    https://3v4l.org/sbaDM
    
    In that case, the tokenization of the `|` operator was not changed to `T_TYPE_UNION` and the `&` operator was not changed to `T_TYPE_INTERSECTION` as the `static` keyword can also be used in return type declarations, so was seen as part of the type declaration.
    
    Fixed now by removing the `T_STATIC` token from the `$allowed` list before walking backwards from the operator.
    
    Includes tests.
    
    Note: this does mean that one test for the `File::getMemberProperties()` method needs to be changed, but as that was testing an illegal syntax anyway, I'm not concerned about making this change.
    jrfnl committed Oct 29, 2023
    Configuration menu
    Copy the full SHA
    6f80106 View commit details
    Browse the repository at this point in the history