-
-
Couldn't load subscription status.
- Fork 146
-
is it possible to use a constant as a value?
example:
$class
->addConstant('TYPE', '\Foo\Bar::class') // not string ???
->setVisibility('protected');
generated:
protected const TYPE = '\Foo\Bar::class';
i need:
protected const TYPE = \Foo\Bar::class;
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
mabar
Dec 25, 2020
$class ->addConstant('TYPE', new \Nette\PhpGenerator\Literal('\Foo\Bar::class')) ->setVisibility('protected');
Replies: 2 comments
-
$class ->addConstant('TYPE', new \Nette\PhpGenerator\Literal('\Foo\Bar::class')) ->setVisibility('protected');
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Answer selected by
dg
-
thx!
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment