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

Invalid value definition #69

Open
edi9999 opened this issue May 19, 2015 · 1 comment
Open

Invalid value definition #69

edi9999 opened this issue May 19, 2015 · 1 comment

Comments

@edi9999
Copy link

edi9999 commented May 19, 2015

Hi I get an error Invalid value definition when I use the following code:

<?php
class Hello {
    const EXPECTED_INPUT_NAME = Array();
}

It works fine with normal constant definition.

The real code I'm using is :

/**
 * @var string[]
 */
const EXPECTED_INPUT_NAME = Array(
    "currency"=>self::MANDATORY,
    "date"=>self::MANDATORY,
    "information"=>self::OPTIONAL,
    "mac"=>self::MANDATORY,
    "offerAmount"=>self::MANDATORY,
    "pos"=>self::MANDATORY,
    "reference"=>self::MANDATORY,
    "status"=>self::MANDATORY,
    "transactionAmount"=>self::MANDATORY,
    "version"=>self::MANDATORY,
);

but I found out that it still fails even with void arrays.

@edi9999
Copy link
Author

edi9999 commented May 19, 2015

This is a PHP 5.6 feature, that's maybe the reason why it is not yet implemented

kdambekalns added a commit to kdambekalns/PHP-Token-Reflection that referenced this issue Oct 20, 2015
This allows ReflectionConstant to parse scalar expressions when defining
constants, such as:

    const FOO = 1 ** 2;
    const BAR = array(1 => 'one');
    const BAZ = 'foo' . 'bar';
    const QUX = \Acme\Com\Demo::class;

Should fix Andrewsville#62 and Andrewsville#69.
kdambekalns added a commit to kdambekalns/PHP-Token-Reflection that referenced this issue Oct 20, 2015
This allows ReflectionConstant to parse scalar expressions when defining
constants, such as:

    const FOO = 1 ** 2;
    const BAR = array(1 => 'one');
    const BAZ = 'foo' . 'bar';
    const QUX = \Acme\Com\Demo::class;

Should fix Andrewsville#62 and Andrewsville#69.
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