-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Declare some types #7092
Declare some types #7092
Conversation
I've tried to minimise the impact so I could already use this in #7054 |
* @param object $entity | ||
* | ||
* @return \Generator | ||
* @return string|int |
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.
What happened here? :|
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.
It was just wrong before, you can see based on the implementation...
{ | ||
return $this->maxValue; | ||
} | ||
|
||
/** | ||
* Gets the next value that will be returned by generate(). | ||
* | ||
* @return int |
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.
Was this previously wrong?
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.
yeap...
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.
I mean, it's not needed with the type hint =)
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.
The hint added nullability
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.
Hmm, no, I think my comment was misplaced
* @param string $serialized | ||
*/ | ||
public function unserialize($serialized) | ||
public function unserialize($serialized) : void |
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.
Can a string
type be added here? Or does it collide with Serializable
?
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.
It collides with Serializable
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.
I'll put the docblock back, my intention was to add the type declaration
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.
done
0412ede
to
ad71982
Compare
ad71982
to
408704b
Compare
🚢 |
@Ocramius Hmm so now documentation of type changes is not required anymore? I am confused. |
@Majkl578 these types are compatible with existing ones, and as we now support PHP 7.2, then subclasses and implementors do not break if we add a type in a superclass or abstract type. |
That is only true for parameter types, but return types were also added here. |
@lcobucci worth adding |
Since now we're require PHP 7.2 we can start to add
object