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

insert->col() and update->col() use variable argument lists #111

Merged
merged 3 commits into from
Jan 1, 2017
Merged

insert->col() and update->col() use variable argument lists #111

merged 3 commits into from
Jan 1, 2017

Conversation

pavarnos
Copy link
Contributor

so IDEs will not show an error if the $value parameter is used.

…ill not show an error if the $value parameter is used.
@@ -119,12 +119,13 @@ public function orWhere($cond)
*
* @param string $col The column name.
*
* @return $this
* @param array $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is extra space, may be you could remove it also for the sake of consistency ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i looked at the code and some @params had a blank line between, some did not. What is your preference? I'll fix the others too...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one space is enough for now. I was also looking at the old code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still not quite understanding: should @param have one blank line between each declaration, or should they be on consecutive lines with no blank line between them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavarnos I was talking about space @param array $value vs @param array $value . I missed to understand you were talking about extra line in b/w @param. You can have an extra line in b/w @param or we can leave that for now :) .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. silly me. fixed now (3 places)

@@ -24,10 +24,11 @@
*
* @param string $col The column name.
*
* @return $this
* @param array $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also.

{
return call_user_func_array(array($this, 'addCol'), func_get_args());
return empty($value) ? $this->addCol($col) : $this->addCol($col, $value[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this may be more performance ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't know. i wanted to make the function signature more explicit so it was easier for IDEs to auto-fill / auto-complete. There is another trickier one in Update.php /~https://github.com/auraphp/Aura.SqlQuery/blob/2.x/src/Common/Update.php#L89 which i will do if this PR gets merged.
Got a few other PRs planned eg a fix for #100 but will start getting merge conflicts if i make too many new PRs before the current ones get merged or rejected...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you can just use $this->addCol($col, ...$params); . I have tried https://3v4l.org/sJ6S0 . I can merge some of the PR's . The interface changes probably need more review from @pmjones .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is much cleaner! thanks!

{
return call_user_func_array(array($this, 'addCol'), func_get_args());
return empty($value) ? $this->addCol($col) : $this->addCol($col, $value[0]);
Copy link
Member

@harikt harikt Dec 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually can't we just use $this->addCol($col, ...$params); here? Tried https://3v4l.org/sJ6S0 .

@harikt harikt merged commit 09642e7 into auraphp:3.x Jan 1, 2017
@harikt
Copy link
Member

harikt commented Jan 1, 2017

Thank you.

@pavarnos pavarnos deleted the col branch January 1, 2017 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants