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

Generics support #7

Merged
merged 90 commits into from
Sep 4, 2022
Merged

Generics support #7

merged 90 commits into from
Sep 4, 2022

Conversation

mrsuh
Copy link
Owner

@mrsuh mrsuh commented Sep 4, 2022

No description provided.

nikic and others added 30 commits June 4, 2022 12:20
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.
WinterSilence and others added 29 commits August 29, 2022 22:09
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.
@mrsuh mrsuh merged commit cb6ff03 into master Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants