-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[12.x] add generics to QueryBuilder’s column related methods #55663
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
[12.x] add generics to QueryBuilder’s column related methods #55663
Conversation
@@ -278,7 +278,7 @@ public function __construct( | |||
/** | |||
* Set the columns to be selected. | |||
* | |||
* @param array|mixed $columns | |||
* @param array<mixed>|mixed $columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not primarily to be read by humans but by tools and for them mixed
and your proposed alternative make a huge difference. If you want to make it more bite-sized, you can always resort to @phpstan-type
or the like
Just as a note, I got some pushback when suggesting a change with |
@cosmastech Thanks for the hint 👍🏻 I had a very vague memory about the PR and that |
@cosmastech Thanks for the heads up. I totally understand Taylor about him getting PhpDoc fatigue (I'm feeling it too...). On one hand, it's great when IDE's can utilize it, but on the other hand, it's hard to read and even harder to validate 😅. So, I think I'll simplify this PR and tone it down a bit to reduce the burden. Btw, I checked |
@@ -278,7 +278,7 @@ public function __construct( | |||
/** | |||
* Set the columns to be selected. | |||
* | |||
* @param array|mixed $columns | |||
* @param mixed $columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array|mixed
can be simplified to mixed
This is another PR to add and improve the PhpDoc by adding generics to types to the Query/Builder.
This will result in better static type checking and better code completion when using IDEs.