-
-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Description
nette/di v 3.1.2
Bug Description
I have set static parameter in neon configuration file with call method of service. Using this parameter concatenated with another literal string throws Nette\InvalidArgumentException.
Steps To Reproduce
Just copy this code and use Test2 in presenter, Nette\InvalidArgumentException is thrown:
Unable to concatenate non-scalar parameter 'param' into '%param%cd'.
class Test1
{
public function getParam(): string
{
return 'ab';
}
}
class Test2
{
public function __construct(private string $param)
{
bdump($this->param); // expected abcd, but exception thrown
}
}
parameters:
param: @App\Test\Test1::getParam()
services:
- App\Test\Test1
- App\Test\Test2(param: %param%cd)
Expected Behavior
Im not sure wheather this is a real bug, or a specific feature, but the behaviour differs from documentation, where are code samples showing concatenation static parameters with strings like %param%abc
Possible Solution
a) best solution make concatenation possible, because this would be useful
b) if not possible a), just let me know and I would prepare PR to describe this feature in documentation.
Metadata
Metadata
Assignees
Labels
No labels