Answer the question
In order to leave comments, you need to log in
How to show hints in IDE for dynamically added methods (magic methods)?
Is it possible for dynamically added methods to display tooltips in the IDE?
Here is an example:
$class = new Mapper;
/**
* @method int sum()
*/
$class->map('sum', fn(...$args) => array_sum($args));
echo $class->sum(1000, 300, 30, 5, 2);
Mapper
this is a conditional class that has an array with added methods and __call
calls to them. sum
, a tooltip taken from docblock is displayed in the last line? Mapper
specify in advance itself @method int sum()
, then the tooltip is displayed, but it is not known in advance which methods will be added, so this option is not suitable.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question