Open ejunker opened 8 years ago
Hmm, that is a bit of a problem. The issue is the string d
is callable
on your machine.
One way to force the string would be to do:
$fm->define('Resume')->setDefinitions([
'salary' => function () { return 'd'; },
]);
That would work but it is a bit verbose. As a user I would expect a literal string to assign a literal string. It would be a breaking change but maybe in the future it could be changed so that if you want to call a callable
that you would have to do something like like this.
$fm->define('Foo')->setDefinitions([
'bar' => $fm->call('myCallable'),
]);
I wonder if I could refactor the generator stuff so that people could choose to disable callables. Would that work for you. In other words, only support closures rather than callables, as an option.
That would work. If callables were disabled I still like the idea of having a helper method that you could pass a string and it would return a closure that calls the callable. Like the $fm->call()
in my previous example.
I'll have a think how I can make this work so it's really nice to use.
I want to hard code a literal value. Here is a minimal example:
The problem is I also have a global function
d()
and it calls thed()
function instead of just using the literal value 'd'. Is there a way to assign literal string values?