Why don't we have PHPDoc @method declarations for the static methods of the Eloquent Model class? #52950
Replies: 1 comment
-
Hi. The forward calls trait forwards calls from model to eloquent builder and then from it to query builder. Adding all methods in the dock blocks is close to impossible. Not even the return types or throws are well documented. For example, increment should return int but it returns eloquent builder despite the dock block saying int. For the model there are some external packages as IDE helpers that add those annotations. We did not like that because the class attributes and model attributes were overlapping, so we published this solution: https://github.com/macropay-solutions/laravel-crud-wizard-free/blob/production/src/Models/Attributes/BaseModelAttributes.php More info in readme |
Beta Was this translation helpful? Give feedback.
-
Well, I recently got back into Laravel, and I noticed something that's been bothering me — the lack of autocomplete for static calls using my models, which is strange because Laravel's route manager has it... but the Eloquent Model class doesn't. I even thought about making a pull request... but I'm not sure about all the necessary methods beyond the basics like
find
,create
,update
,where
, etc.Is there a reason why this doesn't exist? Or is it just a case of "that's not a priority right now," which I get, haha. But it’s pretty annoying to see my PhpStorm complaining that the method doesn't exist (I know you can disable it).
Beta Was this translation helpful? Give feedback.
All reactions