Skip to content
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

Support trait abstract method docstring inheritance and validation #10914

Open
evolbug opened this issue Apr 21, 2024 · 1 comment
Open

Support trait abstract method docstring inheritance and validation #10914

evolbug opened this issue Apr 21, 2024 · 1 comment

Comments

@evolbug
Copy link

evolbug commented Apr 21, 2024

Feature request

Hi! Since PHP 8.0, declared abstract trait method signatures are statically enforced at definition time, they are no longer just suggestions, similar to inheriting from an abstract class, so it would make sense if docstrings would also be passed down.

This would avoid the need of copy-pasting docsctrings and having to keep them in sync. There is a previous issue opened by @Firehed in reference to this.

Looking at other trait related issues, it does sound like the might be some challenges in implementing this, is there anything in particular that would prevent this from working?

Did PHPStan help you today? Did it make you happy in any way?

I love PHPStan, it has brought much needed and ever improving strong static analysis I miss from other languages and has kept my code sane!

@evolbug evolbug changed the title Support trait abstract method docstring validation Support trait abstract method docstring inheritance and validation Apr 21, 2024
@mxr576
Copy link
Contributor

mxr576 commented May 3, 2024

Let me copy the code snippet as an example from my issue that was flagged as duplicate of this one.

https://phpstan.org/r/465f4f45-2dc7-4406-b82c-a21926d1bdc5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants