Skip to content

[5.0] More Specific DocBlocks #8309

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

Merged
merged 1 commit into from Apr 7, 2015
Merged

[5.0] More Specific DocBlocks #8309

merged 1 commit into from Apr 7, 2015

Conversation

GrahamCampbell
Copy link
Member

These functions always return either an integer or a double, so we should use the most specific types possible in our return annotation. mixed should always be avoided when something more specific could be used, like float|int in this case.

@@ -1613,7 +1613,7 @@ public function sum($column)
* Retrieve the average of the values of a given column.
*
* @param string $column
* @return mixed
* @return float|int
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this just be float in all cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't think so? Not sure?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense for an average? I'd even say you can do "float" for all of them. Even though PHP may or may not turn some of the values into integers, I don't see a reason why we cannot simply treat them as floats.

Copy link
Member Author

Choose a reason for hiding this comment

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

The point is that this method, MIGHT return int, though will return float in most cases.

taylorotwell added a commit that referenced this pull request Apr 7, 2015
@taylorotwell taylorotwell merged commit e051a85 into laravel:5.0 Apr 7, 2015
@GrahamCampbell GrahamCampbell deleted the 5.0-builder-fixes branch April 7, 2015 15:38
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.

3 participants