New issue
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
Inherit docblock method from interface thru abstract class #2717
Comments
Confirmed this still happens with phpDoc 3.4.3 |
This structure is the majority of our code base; happy to provide testing or work on a PR if someone points me in the right direction. |
The methods are transformed in the Descriptor namespace, the MethodDescriptor class is a the object type representing a method in the code base. Docblocks of a method are resolved via this method: https://github.com/phpDocumentor/phpDocumentor/blob/master/src/phpDocumentor/Descriptor/MethodDescriptor.php#L205 I think you will need to change something in this trait to make this work: https://github.com/phpDocumentor/phpDocumentor/blob/master/src/phpDocumentor/Descriptor/Traits/HasDescription.php#L36 please let me know when you need some more help to get things started |
The method DocBlock for \phpDocumentor\Descriptor\MethodDescriptor::getInheritedElement describes the correct behavior. Looks like the problem is line 230 returns before checking if there is further inheritance. |
I know no one likes recursion but that seems to be the reliable fix here, with a bail-out after a sane # of recursions. I'll work on a proof of concept. |
Thanks for diving into this. I think you have to keep in mind how this method works. First it will try to find a parent class providing a docblock for the current method. Let's forget about traits for now as they make this more complex. I would love to see some extra unit tests in a pr to ensure we do not break your work in the future. If you need any assistance feel free to comment on this issue or create a draft pr in an early stage so I can guide you a bit to avoid solutions that I don't want to merge. Or a lot of rework on your side. Unfortunately I will be away for about 2 weeks so it might be harder for me to help begining from next week. But after that I will have time to help you when needed. Thanks again for your efforts |
Draft PR #3701 created. |
How do I build or try out the edits I've made on real data? When I try
which is reported here as a known issue... I assume there's a way to get it to build for testing purposes, though, that is not documented in the CONTRIBUTING.md. |
I think you can overwrite this by removing the |
What I normally do to test locally is by running
If you are not using docker you can simply use any directory on your system using the --config to point to the config you want to use. What I do very often is using the data/example directory to test new features. Maybe you could extend the pizza example to cover your use case so we have an option to add some cypress tests in the future. |
There seems to be an inheritance issue in the master branch. If I run v3.4.3, methods in the current class override any parents. This is the expected behavior. If I run the current master branch, methods are returned from the parent class, even if the current class overrides them. Do you know what changes might have been made since 3.4.3 that would have broken this? |
I think that would be this pr: https://github.com/phpDocumentor/phpDocumentor/pull/3375/files#diff-23cf3bc3d273c81962c6616210498f53d0ee54eb25e02525be8347a7f4d26eef We tried to reduce the maintenance burden and duplication by introducing traits in this pr. I think that PR did most of the changes in this area, it's way to big so it will be hard to find the origin. It might be easier to find out what is happening. And solve that rather then trying to figure out what the original implementation looked like. |
Created new issue for that issue, #3706 |
Expected behavior
SomeClass::myMethod() has same description as SomeInterface::myMethod().
Actual behavior
SomeClass::myMethod() has description "{@inheritdoc}".
Environment
The text was updated successfully, but these errors were encountered: