laravel-ide-helper
laravel-ide-helper copied to clipboard
Protected/Private Attributes marked methods are not included in the model docBlock
Versions:
- ide-helper Version: dev-master
- Laravel Version: 8.78.1
- PHP Version: 8.0.13
Description:
As described in the pull request attribute marked methods should be protected which makes them not discoverable by the the ModelsCommand.
Steps To Reproduce:
- Create a protected attribute marked method
- Run the
ide-helper:models
command
While tinkering a bit with how Laravel handles these methods I found that we can get all methods even non-public by using (new ReflectionClass($instance))->getMethods()
instead of get_class_methods()
I would love to see this improvement made to be able to adhere to the recommended code style.
I created PR for this around a month ago- https://github.com/barryvdh/laravel-ide-helper/pull/1325
@mridul89 seems I've forgotten about it; my first reaction: 0 tests. Probably that's the reason I wanted to queue it for later and then forgot about it…
@mfn Sorry about that, i thought the existing tests would be fine since this is a bugfix.
I pushed another commit on the PR https://github.com/barryvdh/laravel-ide-helper/pull/1325 now.
In general, if you add a feature or fix a bug, you write tests for it to prove that it works since the existing tests won't point that out.
It's also a good idea to mention the issue you're fixing in the description of the PR. Since this issue wasn't mentioned in your PR I didn't see it and therefore didn't know it existed.