-
Notifications
You must be signed in to change notification settings - Fork 235
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
Allow doctrine/lexer 2 #460
Conversation
98d1200
to
83fc5d1
Compare
SA is broken, I will fix it once doctrine/lexer 2 is removed, but I just wanted to show here that things are OK according to PHPUnit. |
@@ -126,4 +126,12 @@ protected function getType(&$value) | |||
|
|||
return $type; | |||
} | |||
|
|||
/** @return array{value: int|string, type:string|int|null, position:int} */ | |||
public function peek(): array |
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.
No need to also override glimpse
since it returns whatever peek()
returns.
It is still possible to avoid a BC-break while doing so.
83fc5d1
to
2286f7b
Compare
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.
Sacrificing the Liskov substitution principle on the altar of backwards compatibility. 🤞🏻
{ | ||
$token = parent::peek(); | ||
|
||
return (array) $token; |
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.
Should the array type always be forced here? In v1.13.x
that was not the case because the method was inherited from the parent class. The docblock does not state that an empty array could be returned, but that is exactly what will be returned when the parent returns null
right now.
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.
No, we should not cast null
to an array. Up for a PR?
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.
Fixed in #463 🎉
It is still possible to avoid a BC-break while doing so.