Open jenschude opened 8 years ago
Btw i fixed the issue for me now by creating a method inside the MagicClass called getName, but there could be use cases where you don't know which function name may be called
I will try to look at this issue this evening to see if I can identify the issue with reflection-docblock 3.x
Found the underlying issue in the reflection docblock library. It's located in the DocBlockFactory::parseTagBlock()
When there are magic methods declared without a return type, the tagFactory throws an InvalidArgumentException with message Attempted to resolve "" but it appears to be empty
and as the ClassTagReceiver in prophecy returns an empty array when there is an exception thrown from the docBlockFactory, prophecy doesn't know anything about the magic methods.
So the error itself could be fixed by changing the class doc block from the example to this:
/**
* @method string getName()
* @method mixed getValue()
*/
or for void methods:
/**
* @method string getName()
* @method void getValue()
*/
Is @method getValue()
valid according to PHPDock standards?
The documentation from phpDocumentor says that the return type is optional, even the name is optional
https://phpdoc.org/docs/latest/references/phpdoc/tags/method.html
It doesn't look like @method
declarations from the inheritance tree are considered.
When using the latest version 1.6.1 with reflection-docblock 3.x I now get errors on prophecies using magic methods. When enforcing the use of reflection-docblock 2.x the error is gone.
This is the eror which popped up:
Example code:
Example Test: