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?
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:
What do you think?