Skip to content

Typed class constants support #157

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
4 tasks done
thekid opened this issue Feb 17, 2023 · 3 comments
Closed
4 tasks done

Typed class constants support #157

thekid opened this issue Feb 17, 2023 · 3 comments

Comments

@thekid
Copy link
Member

thekid commented Feb 17, 2023

In a nutshell

class T {
  public const string NAME= 'Test';
}
  • Syntactic support with erasure at compile time (see cad16ee)
  • Emit type in meta information for PHP < 8.3
  • Extend reflection to support types for class constants
  • Emit types once the Typed class constants RFC implementation is merged into PHP 8.3

See also

@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

The RFC has been accepted, need to wait for php/php-src#10444 before adding this to the PHP 8.3 emitter.

@thekid
Copy link
Member Author

thekid commented Apr 17, 2023

PR has been merged, the build from https://github.com/shivammathur/php-builder-windows/actions/runs/4715949822 contains the change:

$ XP_RT=8.3 xp -w 'class T { const string NAME= "Test"; } return T::NAME'
Test

@thekid
Copy link
Member Author

thekid commented Apr 17, 2023

@thekid thekid closed this as completed Apr 17, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in PHP 8.3 adaption Apr 17, 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