Open
Description
This is just a minor question, but I'm curious about the syntax being used to invoke objects as methods.
Example:
$outputs = $this->model->__invoke($modelInputs);
Is it intentional to be calling __invoke(...)
directly, rather than this:
$outputs = $this->model($modelInputs);
Is there evidence that a direct method call is more efficient than the engine figuring out it needs to route the request to a magic method?
I'm asking because PHP docs specifically say this:
Caution All methods names starting with __ are reserved by PHP. Therefore, it is not recommended to use such method names unless overriding PHP's behavior.
which can be interpreted as the only time that you'd manually call a magic method was within the class that is overriding PHP's behaviour, not from outside the class definition.
Metadata
Metadata
Assignees
Labels
No labels