Skip to content

[RFC] Auto-generated dictionary using constants #58

@Nek-

Description

@Nek-

We often use constants in dictionary that needs to be set in the constructor, why not having a class that detect constants and use them as keys & values for dictionary ?

Example:

class AwesomeDictionary extends ConstantDictionary
{
    public const MY_VALUE_1 = 'key';
    public const MY_VALUE_2 = 'key2';
    public const MY_VALUE_3 = 'key3';
}
/*
Generates dictionary
[
    'key' => 'MY_VALUE_1',
    'key2' => 'MY_VALUE_2',
    'key3' => 'MY_VALUE_3',
]
*/

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions