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

Unexpected token error defining constant array in php56 #280

Closed
dario1985 opened this issue Apr 30, 2015 · 6 comments
Closed

Unexpected token error defining constant array in php56 #280

dario1985 opened this issue Apr 30, 2015 · 6 comments
Labels
Milestone

Comments

@dario1985
Copy link

When I try to define a constant array using the const keyword (http://php.net/manual/en/migration56.new-features.php) phpMD (version 2.2.2) generate a "Unexpected token: =>" error.

@ravage84
Copy link
Member

Can you prepare a reduced code example that triggers that errors so we can test it?

@ravage84 ravage84 added the Bug label Apr 30, 2015
@dario1985
Copy link
Author

Yes, sure :)

class Test
{
    const TYPE = 'type';

    const ARRAY_CONST = [
        self::TYPE => 0 // This line generate the error
    ];
}

@ravage84
Copy link
Member

Does it work with the old array syntax?

const ARRAY_CONST = array(
    self::TYPE => 0
);

@manuelpichler
Copy link
Contributor

This issue is related to PDepend issue pdepend/pdepend#192

@dario1985
Copy link
Author

It trigger the same error with the old array syntax too.

class Test
{
    const TYPE = 'type';

    const ARRAY_CONST = array(
        self::TYPE => 0 // This line generate the error
    );
}

@manuelpichler manuelpichler modified the milestones: 2.3.0, 2.4.0 May 29, 2015
@ravage84 ravage84 modified the milestones: 2.4.0, 2.5.0 Mar 8, 2016
@manuelpichler
Copy link
Contributor

Fixed since phpmd@2.3.3

@manuelpichler manuelpichler modified the milestone: 2.5.0 Mar 10, 2016
@ravage84 ravage84 added this to the 2.3.3 milestone Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants