forked from nikic/PHP-Parser
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Generics support #7
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Print abstract/final before visibility modifiers, in line with PSR-12. Closes nikic#826.
* remove space before colon in PrettyPrinterAbstract * update tests
Migrate everything to use PhpToken-compatible token representation, rather than the legacy array/string representation.
Apparently we can't alias an internal class.
Most users will want to pick createForNewestSupportedVersion() or getForHostVersion(). The currently default is the former, which can lead to unwanted surprised due to PHP BC breaks for users that actually want the latter. Make this choice more explicit.
This is not a real expression, treat it similarly to Node\Arg or Node\Param. The old name is retained as an alias for compatibility.
The null/false types were alread accepted previously, even though they are only legal as standalone types since PHP 8.2.
This allows a different token mapping per parser.
Drop the separate tokens class, move them into the parser.
The PHP 7 and PHP 8 parsers use the same grammar file and only differ in token precedence.
Not sure if this is going to stick, but for now this makes it easier to obtain the Lexer instance when creating the parser via ParserFactory.
Cast (boolean) and (integer) should be written as (bool) and (int), (double) and (real) as (float), (binary) as (string).
Unused use statements must be removed.
Listing these is not strictly necessary, in that array/callable are keywords, and as such don't use the relevant code path. We can still include them for the sake of completeness. Closes nikic#872.
Now that destructuring is always represented using List nodes, make sure that Array nodes can no longer contain null elements, so well-typed code doesn't have to deal with them unnecessarily. If an array does contain empty elements, these are now result in an error and are represented as a ArrayItem with Error value if error recovery is used. The implementation is a bit tricky because at the time the Array node is created, we cannot tell whether it will be used in a creation or destructuring context. For this reason the error reporting is delayed parsing has finished. Closes nikic#876.
Array items are not expressions by themselves.
This is part of a statement, not a statement by itself.
Also run these in separate processes, they're not really meaningful if the classes are already loaded.
These constants are now called Modifiers::PUBLIC rather than Class_::MODIFIER_PUBLIC etc, so update the dumped name as well.
This defaults to 0, not Modifiers::PUBLIC.
It is no longer an expression node, which unfortunately does require a more awkward type for the Encaps node.
This uses the same semantics as arrays from leaveNode(), i.e. the returned nodes will not be visited by other visitors. This is open to change though (but probably should change for both enterNode() and leaveNode() if it does change?)
The tests were written in such a way that the regression was not caught.
For better refactoring support, prefer class name over node type.
Also highlights that the list insertion entry for Expr\Match was not used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.