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

Start PHP 8.0 support #47

Merged
merged 8 commits into from
Nov 11, 2020
Merged

Conversation

Slamdunk
Copy link
Contributor

Close #46

@Ocramius
Copy link
Member

In order for this to work, we still need to make sure laminas-code does not crash with:

  • union types
  • mixed type
  • static return type
  • throw expression (foo() ?? throw new \Exception();)
  • match expression
  • null-safe expression (?->)
  • non-capturing catch (try {} catch (\Exception) { return; })
  • named arguments calls
  • attributes
  • trailing comma in function arguments
  • variadic ReflectionFunction::invoke(), ReflectionClass::newInstance(), ReflectionMethod::invoke()
  • ctor property promotion

This is a lot of work that requires much more care for this specific package :S

@Slamdunk Slamdunk changed the title Add PHP 8.0 support Start PHP 8.0 support Oct 21, 2020
@Slamdunk
Copy link
Contributor Author

If you agree, I'll do my best at least to start the support with the current test suite. I've renamed the PR accordingly: is it ok for you?

@Ocramius
Copy link
Member

@Slamdunk if you have time/willpower to throw at the problem, I can gladly support you! This has been on my to-do list as well, since ocramius/proxy-manager is highly dependant on laminas/laminas-code, and an upgrade to PHP 8 will be due soon there too :-)

@Ocramius
Copy link
Member

@Slamdunk an alternative (which had already be planned, but can't find where) is to drop all the scanner components from laminas/laminas-code: that's less effort, and I don't mind releasing a new major version of this package without that stuff.

That effectively means that everything that has to do with token changes can be removed, and therefore half the work is gone.

@boesing boesing added Enhancement hacktoberfest-accepted Issues/Pull-Requests which can be fixed during Hacktoberfest: https://hacktoberfest.digitalocean.com labels Oct 21, 2020
@boesing boesing added this to In progress in PHP 8.0 via automation Oct 21, 2020
@@ -538,6 +538,8 @@ protected function scan()

case T_VARIABLE:
case T_STRING:
case T_NAME_QUALIFIED:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where should I put the backword compatibility definitions for the new constants?

Copy link
Member

Choose a reason for hiding this comment

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

Anywhere you want, as long as it's @internal, I suppose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Analyzing the source, \Laminas\Code\Scanner\TokenArrayScanner::scan seems the right place: https://github.com/laminas/laminas-code/pull/47/files#diff-c08ce1832ae9f8788d45e1cf8fa62d743ede600c44a4e622ec20b4b684383320R383
Had a run with --process-isolation, and everything works fine.

@Slamdunk
Copy link
Contributor Author

@Ocramius well, I just made tests passing on PHP 8.0, I only need to make the BC, see #47 (comment)

@Slamdunk
Copy link
Contributor Author

if you have time/willpower to throw at the problem

From what you wrote, you clearly have much wider perspective on the overall future of this library.
Here I'm just trying to make everything run without fatal errors on PHP 8.0 as I'm upgrading my apps to be ready as soon as possible, so my work stops here for laminas-code.

May I ask you if this PR can be tagged after merge so I can continue my work on laminas-form (laminas/laminas-form#75)?

composer.json Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

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

🚢

PHP 8.0 automation moved this from In progress to Reviewer approved Nov 4, 2020
@weierophinney weierophinney added this to the 3.5.0 milestone Nov 11, 2020
Slamdunk and others added 8 commits November 11, 2020 15:54
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
…PHP 8.0

Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
PHP 8.0 automation moved this from Reviewer approved to Done Nov 11, 2020
@Slamdunk Slamdunk deleted the php_80_support branch November 12, 2020 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement hacktoberfest-accepted Issues/Pull-Requests which can be fixed during Hacktoberfest: https://hacktoberfest.digitalocean.com
Projects
No open projects
PHP 8.0
  
Done
Development

Successfully merging this pull request may close these issues.

PHP 8.0 support
5 participants