-
Notifications
You must be signed in to change notification settings - Fork 333
Using ZendCode for codegeneration #255
base: master
Are you sure you want to change the base?
Conversation
ZendCode reqires |
Tests are ok now, but output is not same. Some type hints were added. For example: 3.3.1: /**
* @param Author $author
* @return Author
*/
public function echoLiteral(Author $author)
{
return $this->__soapCall('echoLiteral', array($author));
} PR: /**
* @param Author $author
* @return Author
*/
public function echoLiteral($author)
{
return $this->__soapCall('echoLiteral', array($author));
} If somebody can test this on his code, it would be great! I have feeling, that we need lot more tests... |
This looks awesome @red-led! I look forward to dig into this. A couple of quick comments for now:
With that in mind this could be the basis for a new 4.x release (which would also include #245) |
@kasperg: I think it's finally ready for your review! : ) |
|
||
use Zend\Code\Generator\DocBlock\Tag\ParamTag; | ||
|
||
class VarTag extends ParamTag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure this should be here. But there are multiple (ok, just two:) uses of this and I thought its better to have this, than not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered submitting this as a pull request to zendframework/zend-code
instead of having it as a custom class here?
); | ||
|
||
self::addMethodParameter($setter, $name, $type, $typeHint, $nullable && !empty($typeHint)); | ||
$setter->getDocBlock()->setTag(new ReturnTag($this->phpNamespacedIdentifier)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this up around L268 along with the rest of the setters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but @return
tag will be before all @param
's. Not so important, but looks little dirty.
@red-led: I started going through the refactoring but I do not have the time to finish it now. I will return to this later. |
Thanks for review, @kasperg! Shold I squash all these commits? |
@red-led: You are welcome to do so. Bear in mind that there might land other changes in the master branch before we merge this so this might require further updates. I will try to help out with this. You have done a lot of work for this already. |
The maintains the coding style across the class.
These can be simplified to use the addMethodParameter method. Refactor parent constructor calling. The generate method is ment for method declaration - not method calling. This results in invalid code when we use the returned ParameterGenerator which may have the default null value set.
It is already generated when adding the parameter to the method.
This enforces the chainable code style of the class.
Hi!
I had some free time today and started work on #58. #6 was created almost 5 years ago! : )
First of all about choosing lib:
Secondly, this is work-in-progress PR. Code will be squashed/rebased after all. But I will really appreciate comments on this code, including even code style : )