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

Initial PHP 8 Support #67

Merged
merged 38 commits into from
Oct 5, 2020
Merged

Initial PHP 8 Support #67

merged 38 commits into from
Oct 5, 2020

Conversation

deleugpn
Copy link
Contributor

@deleugpn deleugpn commented Jul 11, 2020

Provide PHP 8 Support.

composer.json Show resolved Hide resolved
tests/SignedClosureTest.php Outdated Show resolved Hide resolved
@GrahamCampbell
Copy link
Contributor

Thanks for the PR. I've left some feedback.

tests/SignedClosureTest.php Outdated Show resolved Hide resolved
tests/SignedClosureTest.php Outdated Show resolved Hide resolved
@GrahamCampbell
Copy link
Contributor

GrahamCampbell commented Jul 11, 2020

@sorinsarca Is there any reason we don't include array, iterable, callable in the list of builtin types? I think certainly iterable should be in there?

@sorinsarca
Copy link
Member

@GrahamCampbell all should be there, I don't know why they are missing

@GrahamCampbell
Copy link
Contributor

// cc @driesvints for review

src/ReflectionClosure.php Outdated Show resolved Hide resolved
src/ReflectionClosure.php Outdated Show resolved Hide resolved
tests/SignedClosureTest.php Outdated Show resolved Hide resolved
tests/ReflectionClosure6Test.php Outdated Show resolved Hide resolved
@terabytesoftw
Copy link

hi, this will merge soon thanks, great Job.

@deleugpn
Copy link
Contributor Author

Sorry for the delay, this was so much harder than I thought it would be. I finally got all existing tests passing.

I added some new test files during the development process because it was much easier for me to understand the array of tokens with a smaller file. I was pretty much running it on PHP 7.4 and 8.0 and trying to identify different tokens. Let me know if I should revert the new phpunit test files.

I'm not sure what to do with these: https://github.com/opis/closure/pull/67/files#diff-4e781872947f7a06b71197212fc075bcR46
I only took inspiration from Nikita's parser to define the tokens when they don't exist.

Also let me know about the new parser, instead of causing conflict I can try to reimplement. If the new parser is easier to work with, I might be able to use some of the knowledge I gathered while working on this PR to get it working there.

In conclusion, my work here is done for now and this is ready for review

src/ReflectionClosure.php Outdated Show resolved Hide resolved
src/ReflectionClosure.php Outdated Show resolved Hide resolved
tests/ReflectionClosure6Test.php Show resolved Hide resolved
tests/NamespaceFullyQualifiedTest.php Show resolved Hide resolved
@deleugpn
Copy link
Contributor Author

deleugpn commented Sep 5, 2020

  • Nullsafe Operator
  • Trailing Comma
  • Named Parameter
  • Attributes
  • Constructor Property Promotion

@GrahamCampbell
Copy link
Contributor

I think we can merge this without attributes working. A priority is getting PHP 7 compatible syntax to work on PHP 8, which this PR already does. A follow-up PR can add support for every PHP 8.0 feature (which is still a slightly moving target until RC1 comes out, anyway).

@GrahamCampbell
Copy link
Contributor

A priority is getting PHP 7 compatible syntax to work on PHP 8

The lack of this is blocking Laravel from supporting PHP 8.0.

@@ -910,6 +915,11 @@ protected function fetchItems()
$name .= $token[1];
$alias = $token[1];
break;
case T_NAME_QUALIFIED:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still unresolved.

@mnapoli mnapoli mentioned this pull request Sep 28, 2020
4 tasks
@GrahamCampbell GrahamCampbell merged commit e7254e8 into opis:master Oct 5, 2020
@GrahamCampbell GrahamCampbell changed the title Support PHP 8 Initial PHP 8 Support Oct 5, 2020
@deleugpn
Copy link
Contributor Author

deleugpn commented Oct 5, 2020

Thanks! I'll try to look into Attributes now that we're in RC stage of PHP.

@GrahamCampbell
Copy link
Contributor

I've opened a separate issue to track this: #80. It is possible that we might only want to bother with attribute support in v4 of this package (after this PR has been re-implemented for v4). We can discuss on that new issue.

@mnapoli
Copy link

mnapoli commented Oct 5, 2020

Ohh yeah thank you for merging, I'm working on PHP 8 support in PHP-DI and that was a blocker.

Hey there @deleugpn, fun seeing you here! 😄

@Blitheness
Copy link

Should the README be updated to mention PHP 8.0 support? At present, only PHP 5 and 7 are mentioned.

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.

7 participants