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

Fixed semicolon typo #861

Closed
wants to merge 1 commit into from
Closed

Fixed semicolon typo #861

wants to merge 1 commit into from

Conversation

matcracker
Copy link
Contributor

Introduction

Just fixed a semicolon error in the code.

@Sandertv
Copy link
Contributor

Actually, this is intended

@matcracker
Copy link
Contributor Author

Why? o_O

@TheDiamondYT1
Copy link

TheDiamondYT1 commented Apr 22, 2017

@dktapps
Copy link
Member

dktapps commented Apr 22, 2017

Those extra parentheses aren't actually needed at all, but I put them in to clarify that the subtraction should always occur before the division. With method calls this obviously doesn't make any difference, but with operator overloading this would be required. It's merely a cosmetic clarification.

@TheDiamondYT1
Copy link

TheDiamondYT1 commented Apr 22, 2017

@dktapps I thought they were required, because without them you would be calling divide() on a function? Or is that just Java.

@dktapps
Copy link
Member

dktapps commented Apr 22, 2017

No, you'd be calling divide() on the return value of the previous method.

@Sandertv
Copy link
Contributor

Again, this is not Java!

@matcracker
Copy link
Contributor Author

Error
$this->speed = ($to->subtract($from))->divide($tickDiff);

Fix 1
$this->speed = ($to->subtract($from)->divide($tickDiff));

Fix 2
$subtract = $to->subtract($from);
$this->speed = $subtract->divide($tickDiff);

So, is it a PHP issue or PHPStorm stupid? 📦

@jojoe77777
Copy link
Contributor

So, is it a PHP issue or PHPStorm stupid? 📦

Or you?

There's nothing wrong with $this->speed = ($to->subtract($from))->divide($tickDiff);

@matcracker
Copy link
Contributor Author

It's PHPStorm that it give me this error, I know that is correct ...

@pmmp pmmp locked and limited conversation to collaborators Apr 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants