Update parser token constant values to ints instead of strings #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I just came across a incompatibility with this package, and
nikic/php-parser
.This package defines a few "parser token" constants here:
TypeResolver/src/Types/ContextFactory.php
Lines 51 to 57 in e03361c
nikic/php-parser
does something similar (but perhaps more comprehensive?) here: https://github.com/nikic/PHP-Parser/blob/master/lib/PhpParser/compatibility_tokens.phpThe
nikic/php-parser
defines a superset of the tokens defined in this package, with the key difference being they are givenint
values instead ofstring
values.This leads to an issue, where if the code in this package is loaded first, the few tokens that this package has defined will have string values, and break when being used with
nikic/php-parser
as they expect integer values.The PHP documentation seems to indicate that user land defined parser tokens should indeed be
int
values: https://www.php.net/manual/en/tokens.php