Skip to content

Arbitrary static variable initializers #162

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

Closed
thekid opened this issue Apr 8, 2023 · 4 comments
Closed

Arbitrary static variable initializers #162

thekid opened this issue Apr 8, 2023 · 4 comments

Comments

@thekid
Copy link
Member

thekid commented Apr 8, 2023

Support https://wiki.php.net/rfc/arbitrary_static_variable_initializers natively in PHP 8.3 emitter.


Currently, this functionality is emulated by using the following, see implementation status:

use util\Date;

// What gets written
function start() {
  static $now= new Date();

  var_dump($now);
}

// What is emitted
function start() {
  static $now; $now??= new Date();

  var_dump($now);
}
@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

RFC has been accepted, now need to wait for php/php-src#9301 to be merged before being to change PHP 8.3 emitter to emit native code for this.

@thekid thekid moved this to In Progress in PHP 8.3 adaption Apr 10, 2023
@thekid
Copy link
Member Author

thekid commented Jun 6, 2023

Merged in php/php-src@0b1d750

thekid added a commit that referenced this issue Jun 8, 2023
@thekid thekid closed this as completed Jun 8, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in PHP 8.3 adaption Jun 8, 2023
@thekid
Copy link
Member Author

thekid commented Jun 8, 2023

@thekid
Copy link
Member Author

thekid commented Jul 15, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant