We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This line:
https://github.com/gossi/php-code-generator/blob/d67b8f9d775710e9401fc1a9306c7b7797860a65/src/model/parts/TypeDocblockGeneratorPart.php#L52
Overwriting @return tag if you define method type.
This causes that I'm unable to generate method
/**
The text was updated successfully, but these errors were encountered:
Can you give a code example?
Sorry, something went wrong.
Case 1:
$method = PhpMethod::create('MyMethod'); $method->setType('Bar[]'); // $method->getDocblock()->appendTag(ReturnTag::create("Bar[]")); $class = PhpClass::create("Bar") ->setMethod($method); $generator = new CodeGenerator([ 'generateReturnTypeHints' => true ]); print_r($generator->generate($class));
Result
/** * @return Bar[] */ public function MyMethod(): Bar[] {
Case 2:
$method = PhpMethod::create('MyMethod'); // $method->setType('array'); $method->getDocblock()->appendTag(ReturnTag::create("Bar[]")); $class = PhpClass::create("Bar") ->setMethod($method); $generator = new CodeGenerator([ 'generateReturnTypeHints' => true ]); print_r($generator->generate($class));
Result:
/** * @return Bar[] */ public function MyMethod() {
Case 3
$method = PhpMethod::create('MyMethod'); $method->setType('array'); $method->getDocblock()->appendTag(ReturnTag::create("Bar[]")); $class = PhpClass::create("Bar") ->setMethod($method); $generator = new CodeGenerator([ 'generateReturnTypeHints' => true ]); print_r($generator->generate($class));
/** * @return array */ public function MyMethod(): array {
Expected Result ( Comment lines 51-53 in TypeDocblockGeneratorPart.php)
/** * @return Bar[] */ public function MyMethod(): array {
No branches or pull requests
This line:
https://github.com/gossi/php-code-generator/blob/d67b8f9d775710e9401fc1a9306c7b7797860a65/src/model/parts/TypeDocblockGeneratorPart.php#L52
Overwriting @return tag if you define method type.
This causes that I'm unable to generate method
/**
*/
function Foo(): array
The text was updated successfully, but these errors were encountered: