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

Merge php8 back into master #809

Merged
merged 82 commits into from
Feb 1, 2022
Merged

Merge php8 back into master #809

merged 82 commits into from
Feb 1, 2022

Conversation

czosel
Copy link
Collaborator

@czosel czosel commented Oct 24, 2021

Updated version of #807 with resolved conflicts

Selion05 and others added 30 commits February 24, 2021 10:28
feat(php8): union types with new AST node
…tch-statement

# Conflicts:
#	src/ast/matcharm.js
@czosel czosel requested a review from ichiriac October 24, 2021 14:43
Copy link
Member

@ichiriac ichiriac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the first quick review of the code, I would need to run it on my computer and read it again, complementary with coments made on #807

@@ -16,6 +16,11 @@ module.exports = {
case "\r\n":
return this.T_WHITESPACE();
case "#":
if (this._input[this.offset] === "[") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should check the php version before parsing as PHP8

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

src/parser/try.js Show resolved Hide resolved
).toMatchSnapshot();
});
it("can parse anon-class attributes", () => {
expect(parser.parseEval(`$a = new #[T] class {};`)).toMatchSnapshot();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be cool to add tests over previous PHP versions in order to test non regressions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a test for anonymous classes and functions

}
`)
).toMatchSnapshot();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing tests over bad syntax on php 8 like :

#[Foo]
$a = 1;

Copy link
Collaborator Author

@czosel czosel Oct 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call - turns out we're currently dropping the first line instead of parsing it as a comment. I'm not sure about how to fix this correctly, shall we create a separate issue for it? cc @cseufert

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess we need to check if the attribute was consumed, and if not, throw an error. Sorry been absolutely flat out, but will have a look when I get some time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cseufert no worries, thanks for the feedback!

test/snapshot/call.test.js Show resolved Hide resolved
it("knows where a function definiton starts", function () {
const phpCode = `
class b {
// prettier-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should also test with an attribute (as I think they are also included)

class... {
   #[Foo]
   // comment
   public function ...
}

Copy link
Collaborator Author

@czosel czosel Oct 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is already covered here: https://github.com/glayzzle/php-parser/pull/809/files#diff-afaacbd57a577ff9abf9ab4d44fc4ca9a4a814f5ed5fb7a6b381494d268bb5c0R32 (attributes.test.js, can parse params with comments)

@czosel
Copy link
Collaborator Author

czosel commented Oct 24, 2021

@ichiriac @cseufert I'm not sure how much time I'll find to address the comments in the review in the coming days. If you find time, feel free to add commits to this PR (php8 branch on my fork, czosel/php8).

@jaulz jaulz mentioned this pull request Nov 2, 2021
1 task
@czosel
Copy link
Collaborator Author

czosel commented Nov 6, 2021

Hi @ichiriac 🙂 Do you think we can move forward with this? The only open issue is #809 (comment), which we can address in a separate PR i think.

@czosel
Copy link
Collaborator Author

czosel commented Dec 4, 2021

@ichiriac friendly bump 🙃

@czosel
Copy link
Collaborator Author

czosel commented Dec 29, 2021

Hi @ichiriac, happy holidays 🙂 Is there anything I can do to help move this forward?

@jebarjonet
Copy link

@czosel Thanks for this PR 🙂 Should you find someone else to review this PR since @ichiriac has not been answering for months ? This is a pretty big update and it will be useful to a couple of linting and formatting tools for PHP 8.

@jaulz
Copy link

jaulz commented Jan 19, 2022

Maybe @b4dnewz can help since he is the second member of glayzzle?

@czosel
Copy link
Collaborator Author

czosel commented Jan 19, 2022

@jebarjonet Yeah, it would be great if someone else could take a look. I'm not sure if anyone else next to @ichiriac knows the codebase well enough, but I guess slowly the benefits of moving this forward outweigh the risk of introducing issues (which can then be fixed). I also have merge permissions on the repo, but I'd prefer not to use them without anyone else's approval 😉

@alexander-akait
Copy link
Collaborator

@ichiriac Friendly ping

@czosel czosel merged commit f6e545f into glayzzle:master Feb 1, 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.

9 participants